VocabReminder
Easily build a great vocabulary without studying! Now on the App Store!
Click here for more info about the app

Nested Attributes in a Form for Has_One Model Association in Rails

       

Just for reference...


class Member < ActiveRecord::Base
    has_one :member_profile
    accepts_nested_attributes_for :member_profile
end


<% form_for @member do |f| -%> <%= f.label :fullname %> <%= f.text_field :fullname %> <% f.fields_for :member_profile, @member.member_profile do |member_profile|%>

<%= member_profile.label :about %><%= member_profile.text_field :about %>

<%= member_profile.label :favorite_color %><%= member_profile.text_field :favorite_color %>

<% end %>

Tagged w/ #forms #has_one #nestedruby on rails