Skip to content

Instantly share code, notes, and snippets.

@lporras
Created April 21, 2014 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lporras/11144189 to your computer and use it in GitHub Desktop.
Save lporras/11144189 to your computer and use it in GitHub Desktop.
Chosen para select simple_form
# app/inputs/collection_select_input.rb
class CollectionSelectInput < SimpleForm::Inputs::CollectionSelectInput
def input_html_classes
super.push('chosen-select')
end
def html_options_for(namespace, css_classes)
{data: {:placeholder => I18n.t("helpers.select.prompt")}}.merge!(super(namespace, css_classes))
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment