Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

just kinda started doing this randomly, anybody seen this before?

like image 255
loosecannon Avatar asked Jan 18 '11 03:01

loosecannon


3 Answers

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

like image 82
DanneManne Avatar answered Nov 08 '22 05:11

DanneManne


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

like image 29
carl crott Avatar answered Nov 08 '22 05:11

carl crott


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.

like image 2
Tom Avatar answered Nov 08 '22 05:11

Tom