On Tue, Mar 2, 2010 at 8:54 PM, Tom Mac <[email protected]> wrote:
> Hi > I remember once I read about to get only updated fields from an > update_attributes method. Means say I have a model user with > name,age,sex etc And when the user updates the information I have to > first check whether he actually updated anything(There is a chance that > update button from view simply being clicked) and if only any updates > happened I have to get that updated fields and send a mail stating that > these fields are updated. How can I do this. Suppose in the above > example if only name updated > > > Thanks > Tom > Tom, you should be able to do the following to get the attributes that have been changed: model_instance.changed Next, you'll need to store this information prior to saving the changes to the database. Otherwise, the above method will return an empty array. Good luck, -Conrad -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<rubyonrails-talk%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

