Created
September 27, 2012 19:17
-
-
Save camallen/3795872 to your computer and use it in GitHub Desktop.
Simple Form: Array field custom input
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
#Simple form Input class for arrays | |
class ArrayInput < SimpleForm::Inputs::Base | |
def input | |
#override the attribute name for arrays to allow rails to handle array forms | |
input_html_options.merge!({:name => "#{self.object_name}[#{attribute_name}][]"}) | |
@builder.text_field(attribute_name, input_html_options) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment