Error in Polymorphic association with Devise gem

I am creating a Polymorphic association with Devise Gem in Rails 4 but
when saving the form, the data of the User is not saving. In console it
is
showing “Unpermitted parameters: user”.

The main idea is that there are two types of users organizer and vendor
each has different fields in registration form so i want each to have
respective registration form but a single signin form…code is
pasted
here https://gist.github.com/himadriganguly/11112184

Thanks to all in advance.

On Monday, April 21, 2014 10:25:01 AM UTC-4, Joy G. wrote:

Thanks to all in advance.

I’m pretty sure the error is in the register_params of the organiser
controller, but I don’t know why it’s happening. it looks like you have
the correct formats. When you have “f.fields_for :user” it will pass
the
parameters as [user][email], [user][first_name], etc. It looks to me
like
it’s seeing a parameter [user], it isn’t permitted in the strong
parameters, and it’s throwing an error. However, you have
accepts_nested_attributes_for defined and usually when you use the hash
user_attributes in strong parameters, rails takes care of that. You
might
try the following:

params.require(:organiser).permit(:city, :mobile, user: [:first_name,
:last_name, … , :authenticable_type])

if that works, I’m not sure why it’s necessary. When I have time, I’ll
try
to play with this. The only difference between this and other instances
I’ve seen of this type of structure is that in this case, both the
parent
and the associated child record are new vs other situations where the
parent is already established and you’re adding a new child record.
sorry
I haven’t really given you a definitive answer here but hopefully it
will
give you some ideas on where to focus your efforts.

Did you try permit(user_attributes: []) (setting it as an array)? That’s
necessary for any non-scalar attribute in strong parameters.

Walter