Module: Basecoat::FormBuilder

Defined in:
lib/basecoat/form_builder.rb

Instance Method Summary collapse

Instance Method Details

#basecoat_country_select(method, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/basecoat/form_builder.rb', line 13

def basecoat_country_select(method, options = {})
  value = @object.public_send(method) if @object
  options = options.merge(selected: value) if value

  name = "#{@object_name}[#{method}]"

  @template.basecoat_country_select_tag(name, options)
end

#basecoat_select(method, choices, options = {}, html_options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/basecoat/form_builder.rb', line 3

def basecoat_select(method, choices, options = {}, html_options = {})
  value = @object.public_send(method) if @object
  options = options.merge(selected: value) if value

  name = "#{@object_name}[#{method}]"
  options[:group_label] ||= method.to_s.titleize.pluralize

  @template.basecoat_select_tag(name, choices, options)
end