Module: Enumerize::Hooks::FormtasticFormBuilderExtension

Extended by:
ActiveSupport::Concern
Defined in:
lib/enumerize/hooks/formtastic.rb

Instance Method Summary collapse

Instance Method Details

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



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/enumerize/hooks/formtastic.rb', line 12

def input_with_enumerize(method, options={})
  klass = object.class

  if klass.respond_to?(:enumerized_attributes) && (attr = klass.enumerized_attributes[method])
    options[:collection] ||= attr.options

    if attr.kind_of?(Enumerize::Multiple) && options[:as] != :check_boxes
      options[:input_html] = options.fetch(:input_html, {}).merge(:multiple => true)
    end
  end

  input_without_enumerize(method, options)
end