Discover the issue : I had to write correctly my form_for
<% form_for :user, @user, ...
and not <% form_for :user
Oops
On 2 juil, 00:04, Erwin <[email protected]> wrote:
> 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
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---