Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fix guide with field_with_error proc example

  • Loading branch information...
commit e8502edae76e2b1a4fd0c7865579ec41e6f38415 1 parent abb38fe
@asanghi asanghi authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 guides/source/active_record_validations_callbacks.md
View
8 guides/source/active_record_validations_callbacks.md
@@ -953,8 +953,12 @@ Below is a simple example where we change the Rails behavior to always display t
```ruby
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
- errors = Array(instance.error_message).join(',')
- %(#{html_tag}<span class="validation-error">&nbsp;#{errors}</span>).html_safe
+ if html_tag =~ /\<label/
+ html_tag
+ else
+ errors = Array(instance.error_message).join(',')
+ %(#{html_tag}<span class="validation-error">&nbsp;#{errors}</span>).html_safe
+ end
end
```
Please sign in to comment.
Something went wrong with that request. Please try again.