File.open in core Ruby is nifty, in that it automagically closes the
file when you’re done using/manipulating it. I’m wondering whether
there’s something like that for ActiveRecord?
So you can do:
AR.find(23).open {|ar|
ar.foo = ‘bar’
…
}
And ar.save would be called when the block closes.