Reputation: 30385
I am using the nested_form_for gem for the first time. I don't know if this is an issue or if I am using it wrong, but I am getting an "undefined method nested_form_for" error. I have a pretty regular form as you can see:
<%= nested_form_for @user do |f| %>
<%= f.fields_for :godfathers do |godfather_form| %>
<%= godfather_form.label :name %> <br/>
<%= godfather_form.text_field :name %> <br/>
<%= godfather_form.label :description %> <br/>
<%= godfather_form.text_field :description %> <br/>
<%= godfather_form.link_to_remove "Remove this godfather" %>
<% end %>
<%= f.link_to_add "Add a godfather", :godfathers %>
<% end %>
By the way, I installed the gem and ran the: rails generate nested_form:install command
to generate the nested_form.js file that I included in my layout after the jquery inclusion(<%= javascript_include_tag :default, 'nested_form' %>
).
Anyone using this gem as well?
Thanks!
Upvotes: 8
Views: 3177
Reputation: 1704
Everything looks right and if the generator ran the gem should be in place. Have you restarted your server since adding the plugin to your Gemfile?
Upvotes: 20