Skip to content

Commit

Permalink
fix guide with field_with_error proc example
Browse files Browse the repository at this point in the history
  • Loading branch information
asanghi committed Nov 20, 2012
1 parent abb38fe commit e8502ed
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions guides/source/active_record_validations_callbacks.md
Expand Up @@ -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
```

Expand Down

0 comments on commit e8502ed

Please sign in to comment.