Ruby on Rails Monday, December 30, 2013

On Monday, December 30, 2013 5:12:27 PM UTC, Ruby-Forum.com User wrote:
> Colin Law wrote in post #1131851:

> >> @user = User.new(user_params)
>
> >> @user_profile = @user.build_user_profile(params[:user_profile])
>
> >
>
> > Have a look in log/development.log and you will see the parameters you
>
> > are posting and check they are ok. Also you can do thinks like
>
> > inserting puts statements into your code, so if you insert
>
> I found the reason but I can not solve it.
>
> user_profile is unpermitted parameter.
>
>
>
> I added
>
>
>
> def user_params
>
> params.require(:user).permit(:email, :password,
>
> :user_profile_attributes =>[])
>
> end
>

You need to add the attributes that are allowed for user_profile.

Fred

> in the conroller and
>
>
>
> accepts_nested_attributes_for :user_profile
>
>
>
> in the model.
>
>
>
> still the same problem.
>
>
>
> Thanks
>
>
>
> --
>
> Posted via http://www.ruby-forum.com/.

--
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 rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/18c62cc8-dbeb-4d8b-80d0-aa5a69da3248%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment