When I browse to artist_new_path I do not see the fields from the user
table (in this example: city). Why is this?
class User < ActiveRecord::Base
has_one :artist
end
-------------
class Artist < ActiveRecord::Base
belongs_to :user
has_many :medias
validates_presence_of :band_name
accepts_nested_attributes_for :user, :reject_if => lambda { |a|
a[:user].blank? }, :allow_destroy => true
end
-------------
/app/views/artists/new
<%= form_for(@artist) do |f| %>
<ul>
<li class="clearfix">
<%= f.label :band_name %>
<%= f.text_field :band_name %>
</li>
<li>
<% f.fields_for :user do |builder| %>
<%= builder.label :city %>
<%= builder.text_field :city %>
<% end %>
</li>
</ul>
<% end %>
--
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.