lib/carmen/rails/action_view/form_helper.rb
# Generate select and country 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
# 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:
#
#   country_select(@object, :region, {priority: ['US', 'CA']}, class: 'region')
#
# Note that in order to preserve compatibility with various existing
# libraries, an alternative API is supported but not recommended:
#
#   country_select(@object, :region, ['US', 'CA'], class: region)
#
# Returns an `html_safe` string containing the HTML for a select element.
Generate select and country 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
options      - Other options pertaining to option tag generation.

Uses region_options_or_select to generate the list of option tags.





Note that in order to preserve compatibility with various existing
libraries, an alternative API is supported but not recommended.

country_select(@object, :region, ['US', 'CA'], class: region)

Returns an `html_safe` string containing the HTML for a select element.
Generate select and country 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 options - Other options pertaining to option tag generation . Uses region_options_or_select to generate the list of option tags . Note that in order to preserve compatibility with various existing libraries an alternative API is supported but not recommended . country_select ( @object : region [ ' US ' ' CA ' ] class : region ) Returns an ` html_safe ` string containing the HTML for a select element .
def country_select(object, object_name, method, *args)
        priority_countries = args.shift if args.first.is_a?(Array)
        options, html_options = args
        options ||= {}
        options[:priority] = priority_countries if priority_countries
        html_options ||= {}
        tag = InstanceTag.new(object_name, method, self)
        tag.to_region_select_tag(object, object_name, Carmen::World.instance, options, html_options)
      end
def country_select ( object , object_name , method , * args ) priority_countries = args . shift if args . first . is_a? ( Array ) options , html_options = args options ||= { } options [ :priority ] = priority_countries if priority_countries html_options ||= { } tag = InstanceTag . new ( object_name , method , self ) tag . to_region_select_tag ( object , object_name , Carmen :: World . instance , options , html_options ) end
Generate select and country option tags for the given object and method.
Generate select and country option tags for the given object and method .
# These contortions are to provide API-compatibility
object
object_name
method
args