在 RoR 视图中获取 {{attribute}} {{message}} [英] getting {{attribute}} {{message}} in RoR views
问题描述
登录1 个错误禁止保存此 {{model}}
Login 1 error prohibited this {{model}} from being saved
以下字段存在问题:
- {{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 方法中
` 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?
推荐答案
是的,当 Ruby 版本升级到您的 Rails 版本不支持的版本时,就会发生这种情况.较旧版本的 rails 使用较新版本的 Ruby 不支持的语法.
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.
要解决此问题,您应该升级 Rails 或降级 Ruby.
To solve it, you should either upgrade Rails or downgrade Ruby.
Rails 2.3.9 应该足够了.
Rails 2.3.9 should be sufficient.
http://weblog.rubyonrails.org/2010/9/4/ruby-on-rails-2-3-9-released
这篇关于在 RoR 视图中获取 {{attribute}} {{message}}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!