The #changed method from the ActiveRecord::Dirty module should help with this, it gives you an array of all the attributes (a.k.a columns) you've changed on the model. To use it you have to update the attributes and save in two separate steps.
Something like this: @user = User.find(params[:id]) @user.attributes = params[:user] @user.changes # Get the array of what was changed here @user.save! # Then save the model after. Take a look at the documentation for the methods provided in ActiveRecord::Dirty to find out more http://api.rubyonrails.org/classes/ActiveRecord/Dirty.html Cheers, Jeremy On Aug 5, 1:18 am, Hemant Bhargava <[email protected]> wrote: > Champs, > > Actually the scenario is:- > I am updating attributes for a record in a condition.. And then i am > flashing a message stating that record updated .. But the thing is even > if i dont update nething .. i mean the if i'll enter the same data as > previous one then also giving me as updated .. > > So, Can neone let me know that how can i find the number of rows/columns > affected after executing a query in rails .. > > Looking for u guyz .. > > Cheers .. > -- > Posted viahttp://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] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

