Rails3 动态表单插件无法识别?
使用 Ruby 1.9.2 和 Rails 3 -
当尝试使用 <%= error_messages_for 'story' %>
时,我收到此错误:
DEPRECATION WARNING: error_messages_for was removed from Rails and is now available as a plugin. Please install it with `rails plugin install git://github.com/rails/dynamic_form.git`. (called from _app_views_stories_new_html_erb__1042605186_33967248__100840187 at C:/Ruby192/shovell/app/views/stories/new.html.erb:1)
所以我按照它的说明操作并运行插件安装。但是现在我在 vendor/plugins
处有一个空的dynamic_form文件夹。我尝试使用 http
而不是 git
但没有成功。我还在 URL 末尾添加了一个 /
,该 URL 对其他人在线有效,但没有成功。
我将 gem dynamic_form
添加到 Gemfile
中,并将 require "dynamic_form"
添加到 application.rb
中,并重新运行 <代码>捆绑安装。它显示dynamic_form-1.1.3已安装到“lib/ruby/gems/1.9.1/gems/”,但我仍然收到相同的错误。
Using Ruby 1.9.2 and Rails 3 -
When attempting to use <%= error_messages_for 'story' %>
I get this error:
DEPRECATION WARNING: error_messages_for was removed from Rails and is now available as a plugin. Please install it with `rails plugin install git://github.com/rails/dynamic_form.git`. (called from _app_views_stories_new_html_erb__1042605186_33967248__100840187 at C:/Ruby192/shovell/app/views/stories/new.html.erb:1)
So I did what it said and ran the plugin install. However now I have an empty dynamic_form folder at vendor/plugins
. I tried using http
instead of git
with no luck. I also added a /
at the end of the URL which worked for someone else online, but with no luck.
I added gem dynamic_form
to the Gemfile
and require "dynamic_form"
to the application.rb
as well as rerun bundle install
. It shows that dynamic_form-1.1.3 is installed to `lib/ruby/gems/1.9.1/gems/' but I am still getting the same error.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
就我而言,我尝试在我正在构建的 Rails 引擎内部使用
dynamic_form
。我只是将
gem 'dynamic_form'
添加到我的Gemfile
中,进行捆绑安装
并添加到我的
lib/libname.rb< /代码>。重新启动应用程序,一切正常。
In my case, I was trying to use
dynamic_form
inside of a Rails Engine that I was building.I simply added the
gem 'dynamic_form'
into myGemfile
, did abundle install
and addedinside my
lib/libname.rb
. Restarted the app, and all was well.解决方案正如 Jeremy 指出的那样,只需在 github 上下载 Rails/dynamic_form 并将其解压缩到
vendor/plugins
并将文件夹重命名为“dynamic_form”。它之前对我不起作用的原因是因为我使用的是别人的动态表单的修改版本,当然没有指定它。The solution was as Jeremy pointed out, to simply download rails/dynamic_form on github and extract it to
vendor/plugins
and rename the folder "dynamic_form". The reason it didn't work for me before was because I was using someone else's modified version of dynamic form and of course not specifying it.