0

When I acesss http://example.com/users/1/messages/new it says

undefined method `error_message_on' for #<#<Class:0x00000005921d50>:0x0000000591e448>

If I delete the lines that have "error_message_on" from view, no error appears but it shows blank page. so weird :(

messages new view is just like this. whats wrong? Thanks in advance!!

<% form_for @message, :url => user_messages_path(@user) do |f| %>
  <p>
    To:<br />
        <%= f.text_field :to %>
        <%= error_message_on @message, :to %>
  </p>
  <p>
    Subject:<br />
    <%= f.text_field :subject %>
    <%= error_message_on @message, :subject %>
    </p>
    <p>
      Message<br />
      <%= f.text_area :body %>
            <%= error_message_on @message, :body %>
    </p>
    <p>
      <%= submit_tag "Send" %>
    </p>
<% end %>
MKK
  • 2,713
  • 5
  • 31
  • 51

1 Answers1

1

You need to change the erb tags you are using for the form_for declaration. It should be <%= instead of <%. That should fix the blank page.

As far as how to display the error messages, error_message_on was deprecated in Rails 2.3.8. You'll need to use something that is supported in your version of Rails. This question might be of use and there's also this one

Community
  • 1
  • 1
Peter Brown
  • 50,956
  • 18
  • 113
  • 146
  • Thanks for beautiful answer, this gem says "It's rails3 compatible" so that I just followed the direction what it says here https://github.com/jongilbraith/simple-private-messages but it was not compatible. was it? – MKK Jun 20 '12 at 04:47