ruby-on-rails-3 – 无法使用nested_form_for gem

我是第一次使用 nested_form_for gem.我不知道这是一个问题,或者我使用它是错误的,但我得到一个“未定义的方法nested_form_for”错误.
我有一个非常规则的表格,你可以看到:
<%= 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 %>

顺便说一句,我安装了gem并运行:rails generate nested_form:install命令生成我在jquery包含后包含在我的布局中的nested_form.js文件(<%= javascript_include_tag:default,'nested_form'%> ).

谁也使用这个宝石?

谢谢!

解决方法

一切看起来都正确,如果发电机运行宝石应该到位.自从将插件添加到Gemfile后,您是否重新启动了服务器?

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...