Created
March 19, 2012 00:56
-
-
Save webchi/2088226 to your computer and use it in GitHub Desktop.
Custom form error messages for rails and yaml.de css framework
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This this replacemnt for default rails field_with_errors for using http://www.yaml.de/docs/index.html#yaml-forms | |
# Add this to ./config/environment.rb file | |
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
if html_tag =~ /<label/ | |
%|<div class="ym-error"><p class="ym-message">#{[instance.error_message].join(', ')}</p>#{html_tag}</div>|.html_safe | |
else | |
%|<div class="ym-error">#{html_tag}</div>|.html_safe | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment