search for: modify_with_block

Displaying 1 result from an estimated 1 matches for "modify_with_block".

2006 Jul 21
2
File.open behavior for ActiveRecord, to ensure save after manipulation?
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. -- -Alder