diff --git a/lib/carmen/rails/action_view/form_helper.rb b/lib/carmen/rails/action_view/form_helper.rb index 4eb34c4..25848af 100644 --- a/lib/carmen/rails/action_view/form_helper.rb +++ b/lib/carmen/rails/action_view/form_helper.rb @@ -83,6 +83,7 @@ def region_options_for_select(regions, selected=nil, options={}) options.stringify_keys! priority_region_codes = options['priority'] || [] region_options = "" + region_options += options_for_select [[options['prompt'], '']] if options['prompt'] unless priority_region_codes.empty? unless regions.respond_to?(:coded) @@ -101,7 +102,6 @@ def region_options_for_select(regions, selected=nil, options={}) main_options = regions.map { |r| [r.name, r.code] } main_options.sort!{|a, b| a.first.to_s <=> b.first.to_s} - main_options.unshift [options['prompt'], ''] if options['prompt'] region_options += options_for_select(main_options, selected) region_options.html_safe @@ -124,8 +124,8 @@ def region_options_for_select(regions, selected=nil, options={}) # country_select_tag('country_code', {priority: ['US', 'CA']}, class: 'region') # # Returns an `html_safe` string containing the HTML for a select element. - def country_select_tag(name, value, options={}) - subregion_select_tag(name, value, Carmen::World.instance, options) + def country_select_tag(name, value, options={}, html_options={}) + subregion_select_tag(name, value, Carmen::World.instance, options, html_options) end # Generate select and subregion option tags for the given object and method. A @@ -172,6 +172,11 @@ def determine_parent(parent_region_or_code) end end + if Rails.version.to_s > '4' + class InstanceTag < ActionView::Helpers::Tags::Base + end + end + class InstanceTag def to_region_select_tag(parent_region, options = {}, html_options = {}) html_options = html_options.stringify_keys