diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-20 14:59:50 -0800 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-11-20 21:54:06 -0200 |
commit | 4e00e8e91637e117f702ec277a5db1fd087cb347 (patch) | |
tree | 40fd9a54653f412c7fa37415d722eb9a9abcac3c | |
parent | 50f00463bd8348c35cc5dad40116e21323f6822f (diff) | |
download | rails-4e00e8e91637e117f702ec277a5db1fd087cb347.tar.gz rails-4e00e8e91637e117f702ec277a5db1fd087cb347.tar.bz2 rails-4e00e8e91637e117f702ec277a5db1fd087cb347.zip |
Merge pull request #8280 from asanghi/fix_guide_field_with_error_proc
fix guide with field_with_error proc example
[ci skip]
-rw-r--r-- | railties/guides/source/active_record_validations_callbacks.textile | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/railties/guides/source/active_record_validations_callbacks.textile b/railties/guides/source/active_record_validations_callbacks.textile index 15d24f9ac1..d2a445b508 100644 --- a/railties/guides/source/active_record_validations_callbacks.textile +++ b/railties/guides/source/active_record_validations_callbacks.textile @@ -901,8 +901,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 </ruby> |