How to update a few attributes from the model
How to update some of the model's at "+=1"
model.update("in = in + 1, out = out + 1")
Makes a mistake.
When assigning attributes, you must pass a hash as an argument.The annex works at the Postgres database.
Analeea last edited by
You're handing over the line. ActiveRecord doesn't know what to do with it. Method
It'll look like this.
model.update(in: (model.in + 1), out: (model.out + 1))
model.update_attributes(in: (model.in + 1), out: (model.out + 1))
update_attributes- Same thing. The second method is alas for the first.