Displaying 1 result from an estimated 1 matches for "assoc_record".
2006 Jul 27
25
Why are has_one objects resaved when the parent is saved?
If the associated object of a has_one association has been loaded, it
is resaved when the parent is saved. Eg:
class Person < ActiveRecord::Base
has_one :user
end
class User < ActiveRecord::Base
belongs_to :person
end
p = Person.find(:first)
p.save # As expected, nothing happens with the user association
p.user # Loads the associated object
p.save # As well as saving the person, the