You are calling
@user.profile.update_attributes!(profile_params)
This means you're updating attributes on an instance of Profile
(I'll assume that's the model name), not User
. As you've pointed out, :email
is a column on the User
model, not the Profile
model. You're trying to apply a value for key :email
to @user.profile
, a column which Profile
doesn't have, hence the ActiveRecord::UnknownAttributeError - unknown attribute: email:
error.
I'm going to guess instead of the above you really want
@user.update_attributes!(profile_params)
since User
has the :email
attribute, and also likely has accepts_nested_attributes_for :profile
set.