Rails3 动态表单插件无法识别?

发布于 2024-09-30 21:20:25 字数 879 浏览 7 评论 0原文

使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

山田美奈子 2024-10-07 21:20:26

就我而言,我尝试在我正在构建的 Rails 引擎内部使用 dynamic_form

我只是将gem 'dynamic_form'添加到我的Gemfile中,进行捆绑安装并添加

require 'dynamic_form'

到我的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 my Gemfile, did a bundle install and added

require 'dynamic_form'

inside my lib/libname.rb. Restarted the app, and all was well.

说不完的你爱 2024-10-07 21:20:26

解决方案正如 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文