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

Walter

On Apr 21, 2014, at 12:42 PM, mike2r wrote:

> 
> 
> On Monday, April 21, 2014 10:25:01 AM UTC-4, Joy Ganguly wrote:
> 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.
> 
> 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. 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/rubyonrails-talk/2377573a-0a77-4127-bc49-047ab0686ac6%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/rubyonrails-talk/3E2EDC49-56FB-4B59-8C9D-59F819E3AEAD%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to