I have a user object, and a user_profile object.

In my form I have:

<% form_for(:user, :url => object_url, :html => { :method => :put })
do |f| %>
<% f.fields_for :user_profile do |profile_form| %>

      <%= profile_form.label :first_name, t("first_name") %><br />
      <%= profile_form.text_field :first_name %>

      <%= profile_form.label :last_name, t("last_name") %><br />
      <%= profile_form.text_field :last_name %>
<% end %>


In my model:

class User < ActiveRecord::Base
  has_one :user_profile
  accepts_nested_attributes_for :user_profile

attr_accessible :email, :password, :password_confirmation, :user_profile, :user_profile_attributes

And my controller is using the resource_controller plugin.

When I go to do an update, I'm getting:

ActiveRecord::AssociationTypeMismatch (UserProfile(#2197780400)
expected, got HashWithIndifferentAccess(#2159358740))

Here's my data:

Parameters: {"action"=>"update", "_method"=>"put",
"id"=>"1", "controller"=>"admin/users", "user"=>{"user_profile"=>
{"last_name"=>"asdf", "first_name"=>"asdf"},
"password_confirmation"=>"[FILTERED]", "role"=>{"admin"=>"1",
"user"=>"1"}, "password"=>"[FILTERED]", "email"=>""}}

I think the parameter key for updating the user_profile relation
should be user_profile_attributes, I'm not sure why the fields_for
call is generating it without the suffix. Have you checked the bug
tracker? I would test it without the attr_accessible call as well.

Hope that helps,