3
這是我的註冊表格:嵌套形式色器件
<%= form_for(resource, :as => resource_name, :url => registration_path(resource_name)) do |f| %>
<p><%= f.label :email %><br />
<%= f.email_field :email %></p>
<p><%= f.label :password %><br />
<%= f.password_field :password %></p>
<p><%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation %></p>
<%= f.fields_for :profile do |t| %>
<div class ="field">
<%= t.label :type, "Are you an artist or listener?" %><br />
<p> Artist: <%= t.radio_button :type, "Profile::Artist", :id => "artist_button" %></p>
<p> Listener: <%= t.radio_button :type, "Profile::Listener", :id => "listener_button" %></p>
</div>
<% end %>
<p><%= f.submit "Sign up", :id => "new_user_submit" %></p>
<% end %>
我也有這個在我的用戶模型:
accepts_nested_attributes_for :profile
然而,問題是,嵌套在單選按鈕表單甚至沒有出現在頁面上。我怎樣才能解決這個問題?
這很有趣,+1 :) – apneadiving 2011-05-17 22:02:57
你在哪裏加入這一行? – Luc 2013-02-12 11:24:24