Using fields from an association (has_one) model with formtastic in rails
- by subprime
I searched and tried a lot, but I can't accomplish it as I want.. so here's my problem.
My models are:
class User < ActiveRecord::Base
  has_one :profile
  accepts_nested_attributes_for :profile
end
class Profile < ActiveRecord::Base
  attr_accessible :user_id, :form, :title, :name, :surname, :street, :housenumber, :zipcode, :place, :phone, :mobile, :fax, :url 
  belongs_to :user
end
In my view:
<% semantic_form_for @user do |form| %>
  <%= form.inputs :login, :email, :password%>
  <% form.semantic_fields_for :profile do |profile| %>
    <%= profile.inputs %>
  <% end %>
  <%= form.buttons %>  
<% end %>
My problem is that when I edit a person then it shows me the data on the profile. I would, that the fields from the profile even when creating a user are displayed.
Thanks a lot!