Skip to content

Instantly share code, notes, and snippets.

@equivalent
Created July 30, 2012 15:26
Show Gist options
  • Save equivalent/3207789 to your computer and use it in GitHub Desktop.
Save equivalent/3207789 to your computer and use it in GitHub Desktop.
simple_form input extensions in own gems
-#app/views/my_gem/foo.html.haml
= f.input :address_country_id_eq, :as => :country_search, label: 'Country'
#lib/my_gem.rb
require 'simple_form_inputs'
#..other gemstuff
#lib/simple_form_inputs.rb
require 'simple_form'
module SimpleFormMarkdown
class CountrySearchInput < SimpleForm::Inputs::Base
def input
#your input
input_html_options.merge(:some_option=>'foo')
return_string= @builder.text_field(attribute_name, input_html_options)
return return_string.html_safe
end
end
end
SimpleForm::Inputs.send(:include, SimpleFormMarkdown)
~
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment