Rails 4 nested form issue
ruby-on-rails
Solution
You're going to have to permit the fields of item (like name) to be allowed as well.
So try this:
def store_params
params.require(:store).permit(:name, :owner, :description,:url, :user, item_attributes: [:name])
end
Problem
Hi I'm using the nested form plugin and trying to make it work for rails 4 instead of rails 3. Basically my model looks like this: ``` has_many :item, :dependent => :destroy accepts_nested_attributes_for :item, :reject_if => lambda { |a| a[:item].blank? }, :allow_destroy => true ``` and my view looks like this: ``` <%= nested_form_for(@store) do |f| %> <%= f.fields_for :item do |item_form| %> <%= item_form.text_field :name %> <%= item_form.link_to_remove "Remove this item" %> <% end %> <% end %> ``` this works (in terms of presentation - you can add and delete fields like you should be able to) but doesn't save the item names. I tried this in my controller (these are the protected attributes/params): ``` def store_params params.require(:store).permit(:name, :owner, :description,:url, :user, item_attributes) end ``` but it still comes up with: ``` Unpermitted parameters: item_attributes ``` Thanks for all help!