Maybe this can help you: http://stackoverflow.com/questions/3969025/accepts-nested-attributes-for-with-belongs-to-polymorphic
On Aug 8, 2012, at 3:33 PM, Andrey Krisanov wrote: > Yes, see my models https://gist.github.com/3288141 > > среда, 8 августа 2012 г., 11:10:48 UTC+4 пользователь zerogy написал: > If there has_one :character in your model? > > On Aug 8, 2012, at 3:04 PM, Andrey Krisanov wrote: > >> Hello! I write custom registration for different user types. >> >> I have Devise model User and two models (roles) Company and Invidual: >> https://gist.github.com/3288141 >> I created UserObserver https://gist.github.com/3288157 >> Registration view: https://gist.github.com/3288189 and partial (by default >> for Company) https://gist.github.com/3288198 >> >> In addition to the fields of User on the form displays the Name field of >> Company model. >> But when I press the submit button, I get an error "ArgumentError in >> RegistrationController#create" >> Cannot build association character. Are you trying to build a polymorphic >> one-to-one association? >> >> Application Trace | Framework Trace | Full Trace >> app/controllers/registration_controller.rb:14:in `create' >> Request >> Parameters: >> {"utf8"=>"✓", >> "authenticity_token"=>"62bE9GNDQ1QFn5UDP34EmxLlHSRiKzCSPwJO8BiNuYU=", >> "user"=>{"character_type"=>"Company", >> "email"=>"", >> "password"=>"[FILTERED]", >> "password_confirmation"=>"[FILTERED]", >> "character_attributes"=>{"name"=>""}}, >> "commit"=>"Зарегистрироваться"} >> >> How fix it? Thanks for your answers! >> >> -- >> 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msg/rubyonrails-talk/-/v0kbEPY_nn8J. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/qq776fSt2pAJ. > For more options, visit https://groups.google.com/groups/opt_out. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

