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)?
On Aug 21, 9:14pm, Fearless F. [email protected] wrote:
… 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
Frederick C. 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:
ActiveModel::Dirty
Now it’s clear that ActiveRecord includes ActiveModel::Dirty. Thanks,
all.
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?