getting {{attribute}} {{message}} in RoR views
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
ju开发者_Python百科st kinda started doing this randomly, anybody seen this before?
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
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
gem install i18n -v 0.4.0
should solve any issues you've got with rails 2.3.8 and the double curly bracket error messages
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.
cd <yourRailsProject>
gem install i18n -v 0.4.0 -i vendor/ -V
to install the i18n gem into the vendor folder (-V for verbose output, just to see what's going on under the hood)
精彩评论