Devise with many models and ArgumentError in RegistrationController#create

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!

If there has_one :character in your model?

Yes, see my models https://gist.github.com/3288141

среда, 8 августа 2012 г., 11:10:48 UTC+4 пользователь zerogy написал:

Maybe this can help you: