On Apr 7, 8:36 am, John Catalyne <li...@ruby-forum.com> wrote:
> I have these 2 models:
>
> class User < ActiveRecord::Base
>   has_one :city
>   accepts_nested_attributes_for :city
> end
>
> class City < ActiveRecord::Base
>   belongs_to :user
> end
>
> This view:
>
> <%= form_for :user,:url => users_path,:method => :post do |f| %>
>
>   <%= f.fields_for :city_attributes do |b| %>
>   <%= b.collection_select :id,City.all,:id,:name %>
>   <% end %>
>

With accepts_nested attributes this should just be f.fields_for :city

Fred

-- 
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