A child object saved to database just by appending to a pare


#1

Hi all,

I just observed an unexpected behavior of saving. I need some help.
I am using Rails 1.2 and mysql 5.xx.

I created a child object, then appended to a parent object. That is,

child = Child.new
parent.children << child

Before I do, parent.save, I looked at the database table.
this child object row is alredy created there in the child table.

The relationship is quite simple

Parent
has_many :children

Child
belongs_to :parent, :dependent => :nullify

Thank you for any comment

Kye