Created
April 14, 2013 12:41
-
-
Save mortik/5382575 to your computer and use it in GitHub Desktop.
Form Helper for form errors in Rails
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
# encoding: utf-8 | |
module FormHelper | |
def form_error?(obj, method) | |
obj.errors[method].empty? ? '' : 'error' | |
end | |
def form_errors(obj, method) | |
obj.errors[method].join ' ' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment