Created
July 30, 2012 15:26
-
-
Save equivalent/3207789 to your computer and use it in GitHub Desktop.
simple_form input extensions in own gems
This file contains hidden or 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
-#app/views/my_gem/foo.html.haml | |
= f.input :address_country_id_eq, :as => :country_search, label: 'Country' |
This file contains hidden or 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
#lib/my_gem.rb | |
require 'simple_form_inputs' | |
#..other gemstuff |
This file contains hidden or 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
#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