Merge pull request #8280 from asanghi/fix_guide_field_with_error_proc
fix guide with field_with_error proc example
This commit is contained in:
commit
f042b4e88e
|
@ -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"> #{errors}</span>).html_safe
|
||||
if html_tag =~ /\<label/
|
||||
html_tag
|
||||
else
|
||||
errors = Array(instance.error_message).join(',')
|
||||
%(#{html_tag}<span class="validation-error"> #{errors}</span>).html_safe
|
||||
end
|
||||
end
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in New Issue