I want to fetch only changed attributes of an object. Is there any method available which returns all the updated attributes?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given there aren’t many specifics in your question, I’m going to assume you’re referring to ActiveRecord objects. To view the changed attributes on so called “Dirty Objects” you can do the following:
There are also methods for each attribute if you need to check specific ones.
More details here:
http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects