I have a parent-child relationship between two objects.
Parent :has_many :children
Child :belongs_to :parent
When creating a new parent, in the same controller, I'm creating the child.
@mom = Parent.new
@child = Child.new
@mom.children << @child
That all seems to go okay, but this parent has one more attribute - this parent has a favorite child
@mom.favorite_child = @child
Seems like this should work, except let's say that this is the 61st child in the database, so it gets an ID of 61 (and I know this is happening, because when I check the database, the child record has an ID of 61). For some reason, when I assign the @child to the parent's "favorite_child" attribute, "favorite_child" gets set to "1" - when I need it to be set to "61".
Clues?