ruby - Understanding Simple ActiveRecord Updates in Rails -


I'm just diving in ActiveRecord and I can not find an answer to my question. If I am updating the attributes of an object and then calling Save ... will the ActiveCard save only DB when the new values ​​differ from the old values?

Say I do something like this: / P>

  thing_to_update = Thing.find_or_create_by_code (some_code) if thing_to_update.name! = Some_name thing_to_update.update_attribute (: name, some_name) end  

I do not want to make additional calls to DB if I do not have it because I have to update many objects in potentially I Tried to read through docs and it does not mention anything about the older people about comparing new values. Am I missing something here?

Thanks

Used partial SQL updates not used for recording , But it's since April 2008.


Comments

Popular posts from this blog

sql - dynamically varied number of conditions in the 'where' statement using LINQ -

asp.net mvc - Dynamically Generated Ajax.BeginForm -

Debug on symbian -