new.html.erb
Price: <%= f.collection_select :price_ids, Price.all, :id,:name,prompt: true %> JD
コントローラーで:
def dress_attributes
dress_attributes = params.require(:dress).permit(:name,:email,:phone,:description,:image,:image2,[:price_ids: []})
end
show.html.erbで:
Price: <% @dress.prices.each do |s| %>
<%= s.name %>
<% end %>`
そして、価格は表示されません。
を に変更すると何が問題にcollection_select
なりcollection_checked_boxes
ますか? 動作しますが、collection_select
.