Skip to content

Instantly share code, notes, and snippets.

@dejan
Created October 18, 2012 16:51
Show Gist options
  • Save dejan/3913203 to your computer and use it in GitHub Desktop.
Save dejan/3913203 to your computer and use it in GitHub Desktop.
SF CollectionSelectInput monkey patch
# This is a monkey patch for the SimpleForm issue (actually it's a Rails' collection_select issue)
# of adding attributes to select options. Downside is that you loose value/label_method options,
# but that's easily replacable by using map on the collection (and should be done in some decorator anyways).
# See here for more details about the issue: https://github.com/plataformatec/simple_form/issues/188
module SimpleForm
module Inputs
class CollectionSelectInput < CollectionInput
def input
@builder.select attribute_name, collection, input_options, input_html_options
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment