products_controller.rb
def new
@product = Product.new
@product.build_discount
end
product.rb
has_many :discounts, :dependent => :destroy
accepts_nested_attributes_for :discounts
attr_accessible :discounts_attributes
discount.rb
belongs_to :product
_edit_product.html.erb
<%= form_for(product, :html => { :multipart => true }, :remote => true) do |f| %>
// STUFF
<%= f.fields_for :discounts do |discount_form| %>
//does not show up
<% end %>
<% end %>
The content in the fields_for
block does not show up. However, if I change has_many :discounts
to has_many :discount
, the form shows up (get mass assignment error when I try to submit).
Any ideas as to why the form is not rendering in the fields_for
block and why it does render when I change the pluralization?