Module: SubdivisionSelect::TagHelper

Included in:
ActionView::Helpers::Tags::SubdivisionSelect
Defined in:
lib/subdivision_select/tag_helper.rb

Overview

class CountryNotFoundError < StandardError;end

Instance Method Summary collapse

Instance Method Details

#subdivision_option_tagsObject



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/subdivision_select/tag_helper.rb', line 4

def subdivision_option_tags
  option_tags_options = {
    selected: @options.fetch(:selected) { value(@object) },
    disabled: @options[:disabled]
  }

  # Actual loading of subdivisions is in a View helper, since the controller
  # needs to use it, to render the subdivisions of a country in JSON
  subdivisions = SubdivisionsHelper::get_subdivisions_for_select(country)
  options_for_select(subdivisions, option_tags_options)
end