search for: doc_attr

Displaying 1 result from an estimated 1 matches for "doc_attr".

Did you mean: do_attr
2010 Oct 07
1
Question on polymorphic association
...accepts_nested_attributes_for :user end class User < ActiveRecord::Base belongs_to :userable, :polymorphic => true end I have a nested form for doctor and user as OUTER FORM for :doctor INNER FORM for :user end end and in my users controller i have a create action as def create doc_attr = params[:doctor] user_attr = doc_attr.delete(:user) doctor = Doctor.new(doc_attr) doctor.save! doctor.user.create(user_attr) ### getting error on this .................... end When i submit the form i get the error saying undefined method create for nil:NilClass I know this...