Firstly use f.fields_for
instead of fields_for
. The later only creates the fields, but they are not associated with a form object, former is creating fields for associated object.
When you add f.
you will notice that it is not rendering fields. It is caused by your resource
not having associated profile. You are building profile on @user
, but it is different than resource
object.
If you have a look at default implementation of new, it reads:
def new
build_resource({})
respond_with self.resource
end
you are calling this calling super in your new method. You need to build profile between build_resource
and respond_with
, so your new
action should be:
def new
build_resource({})
resource.build_profile
respond_with self.resource
end