lib/carmen/rails/action_view/form_helper.rb
# Generate select and subregion option tags for the given object and method. A
# common use of this would be to allow users to select a state subregion within
# a given country.
#
# object       - The model object to generate the select for
# method       - The attribute on the object
# parent_region_or_code - An instance of Carmen::Region or a 2-character
#                         country code.
# options      - Other options pertaining to option tag generation. See
#                `region_options_for_select`.
# html_options - Options to use when generating the select tag- class,
#                id, etc.
#
# Uses region_options_or_select to generate the list of option tags.
#
# Example:
#
#   subregion_select(@object, :region, {priority: ['US', 'CA']}, class: 'region')
#
# Returns an `html_safe` string containing the HTML for a select element.
Generate select and subregion option tags for the given object and method. A
common use of this would be to allow users to select a state subregion within
a given country.

object       - The model object to generate the select for
method       - The attribute on the object
parent_region_or_code - An instance of Carmen::Region or a 2-character
country code.
options      - Other options pertaining to option tag generation.

Uses region_options_or_select to generate the list of option tags.





Returns an `html_safe` string containing the HTML for a select element.
Generate select and subregion option tags for the given object and method . A common use of this would be to allow users to select a state subregion within a given country . object - The model object to generate the select for method - The attribute on the object parent_region_or_code - An instance of Carmen :: Region or a 2 - character country code . options - Other options pertaining to option tag generation . Uses region_options_or_select to generate the list of option tags . Returns an ` html_safe ` string containing the HTML for a select element .
def determine_parent(parent_region_or_code)
        case parent_region_or_code
        when String
          Carmen::Country.coded(parent_region_or_code)
        when Array
          parent_region_or_code.inject(Carmen::World.instance) { |parent, next_code|
            parent.subregions.coded(next_code)
          }
        else
          parent_region_or_code
        end
      end
def determine_parent ( parent_region_or_code ) case parent_region_or_code when String Carmen :: Country . coded ( parent_region_or_code ) when Array parent_region_or_code . inject ( Carmen :: World . instance ) { | parent , next_code | parent . subregions . coded ( next_code ) } else parent_region_or_code end end
Generate select and subregion option tags for the given object and method.
Generate select and subregion option tags for the given object and method .
parent_region_or_code