Ignore the model names and what they stand for :). They are only for 
example purpose.

So, if I make my view like this:

<%= form_for :user,:url => users_path,:method => :post do |f| %>

  <%= f.fields_for :city do |b| %>
  <%= b.collection_select :id,City.all,:id,:name %>
  <% end %>

  <div class="field">
    <%= f.label :name %><br />
    <%= f.text_field :name %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

Then I get the association mismatch:

City(#37602432) expected, got 
ActiveSupport::HashWithIndifferentAccess(#32969988)

With these parameters:

{"commit"=>"Save User",
 "authenticity_token"=>"whatever",
 "utf8"=>"✓",
 "user"=>{"city"=>{"id"=>"1"},
 "name"=>"as"}}

-- 
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 post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to