Reputation: 1712
How can I do something like:
UPDATE table SET boolean = !boolean WHERE conditions
With an ActiveRecord
model (Without using two queries)?
Upvotes: 0
Views: 922
Reputation: 151
users table in mysql
active : tinyint(2)
in rails console
User.update_all("active = !active", conditions)
Upvotes: 1