Module: Formtastic::TokenInputDefaultForAssociation

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

Instance Method Summary collapse

Instance Method Details

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



9
10
11
12
13
14
15
16
17
# File 'lib/formtastic/token_input_default_for_association.rb', line 9

def default_input_type_with_token_default_for_association(method, options = {})
  if @object
    reflection = reflection_for(method)
    if reflection && reflection.klass.respond_to?(:autocomplete_attribute) && reflection.macro == :belongs_to
      return :token
    end
  end
  default_input_type_without_token_default_for_association(method, options)
end