Archive for July, 2009

July 1

Watch out for using ActiveRecord’s update_attributes on dirty objects

Posted by mtoledo
Filed under rails, ruby | 2 Comments

I’ve recently found out a very odd particularity about how ActiveRecord behaves when relationship properties through the update_attributes method in ActiveRecord::Base. In fact due to its simple implementation, its actually a behavior of any saving of relationships on dirty records.

# in rails ActiveRecord::Base (base.rb)

# Updates all the attributes from the passed-in Hash and saves the [...]