Poking around a little, it's completely an implementation side-effect,
and only appears in the exact case you've described. For instance,
assigning to a has_many doesn't show up in .changes either:
def test_changed_includes_new_record_assignments
album = Album.create! :title => "Give Up the Ghost"
album.artist = Artist.new :name => "Brandi Carlile"
assert album.changes.any?
end
In the belongs_to case in your example, note that the change does get
recorded fairly early (before the before_save callback is invoked), so
you're OK using the dirty tracking in callbacks / observers.
--Matt Jones
> --
>
> 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-
>
co...@googlegroups.com.
> To unsubscribe from this group, send email to
rubyonrails-co...@googlegroups.com
> .
> For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=
> .