Skip to content

Instantly share code, notes, and snippets.

@mcmire
Created March 29, 2011 22:12
Show Gist options
  • Save mcmire/893456 to your computer and use it in GitHub Desktop.
Save mcmire/893456 to your computer and use it in GitHub Desktop.
SimpleForm::Components::Wrapper.module_eval do
def input_html_classes
[input_type, required_class]
end
def wrapper_html_options
input_html_classes << SimpleForm.wrapper_class
if options[:wrapper_class]
input_html_classes += options[:wrapper_class].split(" ")
end
if input_html_classes.nil?
raise "This will always fail even if options[:wrapper_class] == false, because input_html_classes was seen even if it wasn't set!"
end
if has_errors?
input_html_classes << SimpleForm.wrapper_error_class
if options[:wrapper_error_class]
input_html_classes += options[:wrapper_error_class].split(" ")
end
end
html_options_for(:wrapper, input_html_classes)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment