3

This is a very common piece of code

<% form_for :blah... do |f| %>
<%= f.error_messages %>
First name: <%= f.text_field :first_name %><br />
....
<% end %>

error_messages is a helper method but I am having a hard time finding the documentation for it, why is that?

Kick Buttowski
  • 6,631
  • 13
  • 35
  • 57
Bob
  • 8,364
  • 13
  • 66
  • 109

1 Answers1

6

I found them here: error_messages have same params as error_messages_for.

In Rails 3 however, error_messages and error_messages_for have been deprecated and have been moved out to a plugin.

mahemoff
  • 41,502
  • 34
  • 146
  • 213
morgan freeman
  • 5,931
  • 3
  • 24
  • 31
  • Thanks for the info but how did you know that both have the same params? That's the part that irks me, I don't see any clear reference to that effect. – Bob Jun 11 '10 at 20:38
  • You're right. I couldn't find any doc for that. Having a look at the code though, make it clear for me: http://bit.ly/dyXaYs . Seems that all error_messages is doing is call error_messages_for with the options received as params. Hope this helps. – morgan freeman Jun 12 '10 at 04:17