Module: ActionView::Helpers::FormOptionsHelper
- Defined in:
- lib/countryselect0r/base.rb
Instance Method Summary collapse
- #country_options_for_select(selected = nil, priority_countries = nil) ⇒ Object
- #country_select(object, method, priority_countries = nil, options = {}, html_options = {}) ⇒ Object
Instance Method Details
#country_options_for_select(selected = nil, priority_countries = nil) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/countryselect0r/base.rb', line 20 def (selected = nil, priority_countries = nil) = "" if priority_countries && priority_countries.is_a?(Array) # +_+ # priority_countries.each do |pc| # +_+ # += ({ Iso3166.localize(pc) => pc }, selected) end #country_options += options_for_select(priority_countries, selected) += "<option value=\"\" disabled=\"disabled\">-------------</option>\n" selected=nil if priority_countries.include?(selected) end countries = Iso3166.codes.map { |code| [Iso3166.localize(code), code] } = .html_safe if .respond_to?(:html_safe) return + (countries, selected) end |
#country_select(object, method, priority_countries = nil, options = {}, html_options = {}) ⇒ Object
16 17 18 |
# File 'lib/countryselect0r/base.rb', line 16 def country_select(object, method, priority_countries = nil, = {}, = {}) InstanceTag.new(object, method, self, .delete(:object)).to_country_select_tag(priority_countries, , ) end |