Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ruby-on-rails-3/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 引导形式错误未定义方法_Ruby On Rails_Ruby On Rails 3_Forms - Fatal编程技术网

Ruby on rails 引导形式错误未定义方法

Ruby on rails 引导形式错误未定义方法,ruby-on-rails,ruby-on-rails-3,forms,Ruby On Rails,Ruby On Rails 3,Forms,1-我安装了gem引导程序\u表单 2-我在application.css中写到,*/前面的行*=需要引导\u表单 3-在my html.erb中 <%= bootstrap_form_for(@guardian, :url => student_guardians_path(@student), html: { class: 'form-horizontal' }, method: :post) do |f| %> 学生监护人路径(@student), html:{clas

1-我安装了gem引导程序\u表单
2-我在application.css中写到,*/
前面的行
*=需要引导\u表单
3-在my html.erb中

<%= bootstrap_form_for(@guardian, :url => student_guardians_path(@student),
html: { class: 'form-horizontal' },
method: :post) do |f| %>
学生监护人路径(@student),
html:{class:'form horizontal'},
方法::post)do | f |%>

我得到了以下错误:
undefined method
bootstrap\u form\u for“for”`

我得到了相同的错误。通过替换来修复它

gem 'bootstrap-form'


在我的
gemfile
中,我也遇到了这个错误,直到我意识到我没有重新启动rails服务器。当我重新启动服务器时,错误消失了。

我最近遇到了这个问题,我的问题是bundle安装似乎在拉v3.0.0,但GitHub上的最新版本被列为2.3.0。将我的文件中的相应行更改为:

gem 'bootstrap_form', '~> 2.3.0'

已修复此问题。

此问题通过正确编写表单代码得以解决,如@sunny1304([@student,@guardian]
的注释
bootstrap\u form\u中所示。因此,如果现有答案都不适用于您,那么这可能是一个提示或指导您的内容


感谢其他贡献者,因为他们的回答帮助了像我这样面对这个问题的其他用户。

你在Gemfile中添加了gem吗?是的,但不是在特定的组中,只是将它写在我的gem文件的顶部尝试引导表单([@student,@guardian]……然后删除url,你不需要它,因为你正在用对象绑定表单。是的,这是我的问题。我可以发誓码头上说用破折号代替下划线。Doh!
gem 'bootstrap_form', '~> 2.3.0'