0
Railcasts에서 Episode 196을 따라 갔지만, 내가 따르더라도 아직 작동하지 않는 것 같습니다. 코드가 오래되었거나 난 그냥 레일을 얻지 못할 수도 있습니다. 여기중첩 된 폼 레일
내가 3 개 모델
Customer Book Book_Manager
id id id
first description customer_id
last book_manager_id visible
email
password
여기
있는 나의 관계를
Book
belongs_to :book_manager
def customer
book_manager.customer
end
Customer
has_many :book_managers, :dependent => :destroy
accepts_nested_attributes_for :book_managers
BookManager
belongs_to :customer
has_many :books, :dependent => :destroy
accepts_nested_attributes_for :books
양식은 내가 줄을 주석으로 경우
<%= form_for @bookmanager do |f| %>
<%= f.fields_for :books do |builder| %>
<div>
<%= builder.label :description %><br />
<%= builder.text_area :description, :rows => 3 %>
</div>
<% end %>
<div class="field">
<%= f.label :visible %><br />
<%= f.text_field :visible %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
에 따라 가지고있다
accepts_nested_attributes_for :books
설명 상자가 보이지만 상자를 놓으면 상자가 사라집니다. 내가 뭐 놓친 거 없니??
고마워요, 이제는 작성 및 업데이트 조치를 설정해야합니다. 고맙습니다. – Jseb