Class: ActionView::Helpers::FormBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/subdivision_select/subdivision_select_helper.rb

Instance Method Summary collapse

Instance Method Details

#subdivision_select(method, country_or_options = {}, options = {}, html_options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/subdivision_select/subdivision_select_helper.rb', line 4

def subdivision_select(method, country_or_options = {}, options = {}, html_options = {})
  # Shift args, if necessary
  if Hash === country_or_options
    html_options = options
    options = country_or_options
  else
    options[:country] = country_or_options
  end

  # I think this is taken care of in the merge below?
  #options.merge!({ object: @object })

  @template.subdivision_select_tag(
    @object_name,
    method,
    objectify_options(options),
    @default_options.merge(html_options)
  )
end