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 %>
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_onwas 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