Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show full error messages with simple form?

How do I output the full error message of a field using simple form? The equivalent of rails: <%= RESOURCE.errors.full_messages %>

e.g. show this:

"Email has already been taken", 
"Password confirmation doesn't match Password", 
"Password is too short (minimum is 8 characters)"

instead of: f.error_notification

"has already been taken", 
"doesn't match Password", 
"is too short (minimum is 8 characters)"

simple_form (3.0.2)/Rails 4.1.1

like image 301
MrPizzaFace Avatar asked Jun 23 '14 03:06

MrPizzaFace


1 Answers

If anyone is still wondering there is an easy way to do this now, as referenced here

Simply under config/initializers/simple_form.rb change b.user :error to b.user :full_error and now your error messages will be the equivalent of RESOURCE.errors.full_messages

Note: if you are using bootstrap w/ simple form you change simple_form_bootstrap.rb

like image 177
super_noobling Avatar answered Oct 25 '22 21:10

super_noobling