I have a User model
class User < ActiveRecord::Base
has_one :account
accepts_nested_attributes_for :account, :allow_destroy => true
validates_associated :account
attr_accessible :account_attributes
is working fine, validating and updating both records (User and
Account), but I caanot display the value in the form when is updated,
ex: below the firstname is not displayed but it’s in the db account
record
#<User id: 1, email: “[email protected]”, …
#<Account id: 4, user_id: 1, title: 0, first_name: “Yves”, …
my view
…
<% form_for :user, :url => { :action => “update” } do |user_form|
%>
<% user_form.fields_for :account_attributes do |account_fields| %>
<li>
<label for="user_firstname">First Name</label>
<%= account_fields.text_field :first_name, :size => "30" %>
</li>
…
what am I missing ?
thanks for your help
erwin