If my table reads like this: create_table(:pet_owners, :force => true) do |t| t.boolean :has_allergies end ... then ActiveRecord::Base generates the following methods: :has_allergies :has_allergies:has_allergies? :has_allergies_before_type_cast :has_allergies_change :has_allergies_changed? :has_allergies_was :has_allergies_will_change! :reset_has_allergies! The first four I recognize from the documentation. But what about the remaining five? If they do what I *think* they do, they could be useful. But I''d prefer not use trial and error to find out if I could RTFM instead. So: Where are they documented (other than in the source code)? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
waseem ahmad
2011-Aug-21 08:54 UTC
Re: methods generated for an AR field: what do they do?
On Sun, Aug 21, 2011 at 4:52 AM, Fearless Fool <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> So: Where are they documented (other than in the source code)?Following might be useful. http://ar.rubyonrails.org/classes/ActiveRecord/Dirty.html http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-dirty-objects http://railscasts.com/episodes/109-tracking-attribute-changes -- Waseem Blog: http://babygnu.blogspot.com Twitter: http://twitter.com/_waseem -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Fearless Fool
2011-Aug-21 20:14 UTC
Re: methods generated for an AR field: what do they do?
waseem ahmad wrote in post #1017743:> Following might be useful. > http://ar.rubyonrails.org/classes/ActiveRecord/Dirty.htmlGot that, and I notice that those are all vintage 2008. But I also note that in: http://apidock.com/rails/ActiveRecord/Dirty ... that ActiveRecord::Dirty "...is deprecated or moved on the latest stable version." Is there another mechanism I should be using for tracking changes to fields? -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Frederick Cheung
2011-Aug-21 20:26 UTC
Re: methods generated for an AR field: what do they do?
On Aug 21, 9:14 pm, Fearless Fool <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> waseem ahmad wrote in post #1017743: > > > Following might be useful. > >http://ar.rubyonrails.org/classes/ActiveRecord/Dirty.html > > Got that, and I notice that those are all vintage 2008. But I also note > that in: > > http://apidock.com/rails/ActiveRecord/Dirty > > ... that ActiveRecord::Dirty "...is deprecated or moved on the latest > stable version." Is there another mechanism I should be using for > tracking changes to fields?The guts were moved into ActiveModel, but you can use it with active record just like you used too. There was some fairly major refactoring in rails 3 which confuses apidock quite a bit. Fred> > -- > 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Fearless Fool
2011-Sep-09 12:47 UTC
Re: methods generated for an AR field: what do they do?
Frederick Cheung wrote in post #1017751:> The guts were moved into ActiveModel, but you can use it with active > record just like you used too. There was some fairly major refactoring > in rails 3 which confuses apidock quite a bit.Word. I eventually found the more modern docs for ActiveModel::Dirty -- it explains a bit more of what''s going on: http://api.rubyonrails.org/classes/ActiveModel/Dirty.html Now it''s clear that ActiveRecord includes ActiveModel::Dirty. Thanks, all. -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.