Displaying 1 result from an estimated 1 matches for "address_builder".
2010 Dec 07
1
fields_for and one out of many from association
...9;preferred desc, id''
accepts_nested_attributes_for :addresses, :allow_destroy => true
accepts_nested_attributes_for :primary_address, :allow_destroy =>
true
end
class Address < ActiveRecord::Base
belongs_to :person
end
In the view:
<% f.fields_for :primary_address do |address_builder| %>
<%= render ''addresses'', :f => address_builder %>
<% end %>
The ''addresses'' table has a boolean column named ''preferred'' and there
should be only one address for the person that is the preferred one.
Testing on the conso...