Created
November 20, 2011 20:28
-
-
Save swalberg/1380843 to your computer and use it in GitHub Desktop.
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
class LocalFormBuilder < ActionView::Helpers::FormBuilder | |
def label(method, text = nil, options = {}) | |
#Check to see if text for this label has been supplied and humanize the field name if not. | |
text = text || method.to_s.humanize | |
#Get a reference to the model object | |
#Add any additional text that might be needed on the label | |
text += " <span class=\"text\">#{h options[:description]}</span>".html_safe if options[:description] | |
text += "<span class=\"required\">*</span>".html_safe if options[:required] | |
#Finally hand off to super to deal with the display of the label | |
super(method, text, options) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment