nested attributes form

Hello!

I have a simple form with a nested attribute (has_one association). Is works has expected on the new and create actions, the nested attribute is correctly added in the database. But when I am on the edit action the nested attributes fields are empty... and I am using the same partial for the form.

Am I missing something? Why I don't get the nested fields displayed?

  <% form.fields_for :address do |address| %>     <% field do %>       <%= label_tag "advert_address_address", t(:address, :scope => [:activerecord, :attributes, :address]), :class => :label %>       <%= address.text_field :address %>       <%= address.hidden_field :lat %>       <%= address.hidden_field :lng %>     <% end %>   <% end %>

Greg

I found the error. I was rebuild the association each time. @advert.build_address