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,709
  • 13
  • 37
  • 58
Bob
  • 8,424
  • 17
  • 72
  • 110

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
  • 44,526
  • 36
  • 160
  • 222
morgan freeman
  • 6,041
  • 3
  • 25
  • 32
  • 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