diff options
author | Aditya Sanghi <aditya.sanghi@risingsuntech.net> | 2012-11-20 19:08:51 +0530 |
---|---|---|
committer | Aditya Sanghi <aditya.sanghi@risingsuntech.net> | 2012-11-20 19:24:27 +0530 |
commit | e8502edae76e2b1a4fd0c7865579ec41e6f38415 (patch) | |
tree | f492fde0ae9c85788ef8163afc5cb1b6edb1d057 /guides | |
parent | abb38feac84da59f6686d9abcce61d2a9a64efa9 (diff) | |
download | rails-e8502edae76e2b1a4fd0c7865579ec41e6f38415.tar.gz rails-e8502edae76e2b1a4fd0c7865579ec41e6f38415.tar.bz2 rails-e8502edae76e2b1a4fd0c7865579ec41e6f38415.zip |
fix guide with field_with_error proc example
Diffstat (limited to 'guides')
-rw-r--r-- | guides/source/active_record_validations_callbacks.md | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/guides/source/active_record_validations_callbacks.md b/guides/source/active_record_validations_callbacks.md index 5c27ccbf9e..0f4140b650 100644 --- a/guides/source/active_record_validations_callbacks.md +++ b/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"> #{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 ``` |