Reputation: 12072
I have a model, foo.rb
. A user can have many "foos". I want to select a specific "foo", make change to their table column then save all at once:
f = Foo.where(bar: 1) # returns, say, four objects.
Now, I want to change: bar: 10
, then save:
f.map do |x| x.bar = 10 end
How do you save? I cannot figure this out in irb. Is it possible with less code?
Upvotes: 0
Views: 119