0

When I use the following validation:

 validates_length_of :lgtitle, :maximum=>45, :message=>"Please reduce the number of characters used in the Before Like Title. The maximum is 45 characters."

Rails returns the message and the table row in my view:

Lgtitle Please reduce the number of characters used in the Before Like Title. The maximum is 45 characters.

What is the best practice for eliminating the table table row string that is added to the validation message?

Thank you.

JZ.
  • 21,147
  • 32
  • 115
  • 192
  • There was a similar question few time ago. Here is the link : http://stackoverflow.com/questions/690267/using-rails-validation-helpers-message-but-want-it-without-listing-the-column-na – christianblais Sep 07 '11 at 23:18

1 Answers1

1

Error messages are added in model.errors which is a Hash.

  • Keys are column names

  • Values, the message itself

I bet you display both key and value.

apneadiving
  • 114,565
  • 26
  • 219
  • 213