在 RoR 视图中获取 {{attribute}} {{message}}
登录 1 个错误禁止保存此 {{model}}
以下字段存在问题:
- {{attribute}} {{message}}
这是视图代码
<h1>Login</h1>
<% form_for @user_session, :url => user_session_path do |f| %>
<%= f.error_messages %>
<%= f.label :login %><br />
<%= f.text_field :login %><br />
<br />
<%= f.label :password %><br />
<%= f.password_field :password %><br />
<br />
<%= f.check_box :remember_me %><%= f.label :remember_me %><br />
<br />
<%= f.submit "Login" %>
<% end %>
` 这很奇怪,当输出以几个月为单位时,它会显示在 time_ago_in_words 方法中
,只是有点开始随机执行此操作,有人以前见过吗?
Login
1 error prohibited this {{model}} from being saved
There were problems with the following fields:
- {{attribute}} {{message}}
this is the view code
<h1>Login</h1>
<% form_for @user_session, :url => user_session_path do |f| %>
<%= f.error_messages %>
<%= f.label :login %><br />
<%= f.text_field :login %><br />
<br />
<%= f.label :password %><br />
<%= f.password_field :password %><br />
<br />
<%= f.check_box :remember_me %><%= f.label :remember_me %><br />
<br />
<%= f.submit "Login" %>
<% end %>
`
its odd and it shows up on in the time_ago_in_words method when the out put is in months
just kinda started doing this randomly, anybody seen this before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
是的,当 Ruby 版本升级到您的 Rails 版本不支持的版本时,就会发生这种情况。旧版本的 Rails 使用新版本的 Ruby 不支持的语法。
要解决这个问题,您应该升级 Rails 或降级 Ruby。
Rails 2.3.9 应该足够了。
http://weblog.rubyonrails.org /2010/9/4/ruby-on-rails-2-3-9-发布
Yes, it happens when the version of Ruby has been upgraded to a version that is not supported by your version of Rails. Older version of rails uses a syntax that is not supported by newer versions of Ruby.
To solve it, you should either upgrade Rails or downgrade Ruby.
Rails 2.3.9 should be sufficient.
http://weblog.rubyonrails.org/2010/9/4/ruby-on-rails-2-3-9-released
i18n gem 需要与您正在运行的 RUBY 和 RAILS 版本相对应...
i18n 的变更日志。
http://blog.plataformatec.com.br/2010/ 02/rails-3-i18n-changes/
运行
gem uninstall i18n
然后
应该可以解决 Rails 2.3.8 和双大括号错误消息所遇到的任何问题
the i18n gem needs to correspond to the version of RUBY and RAILS that you're running ...
changelog for i18n.
http://blog.plataformatec.com.br/2010/02/rails-3-i18n-changes/
running
gem uninstall i18n
then
should solve any issues you've got with rails 2.3.8 and the double curly bracket error messages
如果你安装了 i18n gem,你也可能会遇到这个问题。我已经安装了 metrical,它的依赖项之一是 i18n gem。这导致了与上面相同的错误。当我移除宝石后,我又开始看到正确的消息。
You can also run into this if you install the i18n gem. I had installed metrical, and one of its dependencies is the i18n gem. This caused the same error as above. Once I removed the gem, I started seeing the correct messages again.
将 i18n gem 安装到供应商文件夹中(-V 用于详细输出,只是为了看看幕后发生了什么)
to install the i18n gem into the vendor folder (-V for verbose output, just to see what's going on under the hood)