Hello there! I have a question about polymorphic associations. Suppose we have a parent class Parent and a child class Child, to create a new object I do something like: class Child ... :has_one :parent, :as => :resource :validates_presence_of :name ... end class Parent ... :belongs_to :resource, :polymorphic => true ... end child = Child.new parent = ParentClass.new parent.resource = child parent.save! but when validation of Child fails, rails still try to execute "insert into parents (..., resourse_id) ... (..., NULL)", and because my db does not allow resource_id to be NULL, it raises a StatementInvalid exception instead of raising RecordInvalid (as it should be if the validation fails). Am I doing something wrong or it''s just a bug of rails? Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---