Joshua Partogi
2010-Apr-01 21:28 UTC
`changes` method in ActiveModel::Dirty is not working
Hi all, I have tested the method changes in ActiveModel::Dirty but it doesn''t return any result. In my ActiveRecord object I call it as documented:> person.changesbut it returned null But when I call other methods in the ActiveModel::Dirty module such as `changed` and `changed?`, it returns value(s). Has the method `changes` been implemented, or do I call the method wrongly? Kind regards, Joshua -- http://twitter.com/scrum8 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Kristopher Murata
2010-Apr-08 01:17 UTC
Re: `changes` method in ActiveModel::Dirty is not working
It''s working on latest master code, which rails and ruby version are you using? The proper behavior is something like this: irb(main):005:0> p = Post.first => #<Post id: 1, title: "Test", created_at: "2010-04-06 02:33:28", updated_at: "2010-04-06 02:33:28"> irb(main):006:0> p.title = "Test changes" => "Test changes" irb(main):007:0> p.changes => {"title"=>["Test", "Test changes"]} On Thu, Apr 1, 2010 at 5:28 PM, Joshua Partogi <jpartogi@scrum8.com> wrote:> Hi all, > > I have tested the method changes in ActiveModel::Dirty but it doesn''t > return any result. > > In my ActiveRecord object I call it as documented: > > > person.changes > > but it returned null > > But when I call other methods in the ActiveModel::Dirty module such as > `changed` and `changed?`, it returns value(s). > > Has the method `changes` been implemented, or do I call the method wrongly? > > > Kind regards, > Joshua > > > -- > http://twitter.com/scrum8 > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-core+unsubscribe@googlegroups.com<rubyonrails-core%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-core?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.