has_many + through + nested model

Hello Friends, I am stucked with the nested model with through association I have class Office < AR::B has_many :office_user_details has_many :user_details, :through => :office_user_details accepts_nested_attributes_for :user_details end class UserDetail < AR::B has_many :office_user_details has_many :offices, :through => :office_user_details accepts_nested_attributes_for :offices end class OfficeUserDetail < AR::B belongs_to :user_details belongs_to :offices end FORM <% form_for @user do |f| %> <% f.fields_for :user_detail_attributes do |user_detail| %>

<%= user_detail.label :given_name %>

<%= user_detail.text_field :given_name %>

<% user_detail.fields_for :offices_attributes do |office| %>

<%= office.label :office_name %>

<%= office.text_field :office_name %>

<%end%> <%end%>

<%= f.submit 'Sign Up' %>

<%end%> But getting the following error **undefined method `stringify_keys' for "Andy Inc":String (NoMethodError)**

Thanks Abhishek

Does this work>

<% form_for @user do |f| %>

  <% f.fields_for :user_details do |user_detail| %>       <p><%= user_detail.label :given_name %></p>       <p><%= user_detail.text_field :given_name %></p>

      <% user_detail.fields_for :offices do |office| %>         <p><%= office.label :office_name %></p>         <p><%= office.text_field :office_name %></p>       <%end%>

  <%end%>   <p><%= f.submit 'Sign Up' %></p> <%end%>

Darian Shimy