Module: M2MFastInsert::HasAndBelongsToManyOverride

Defined in:
lib/m2m_fast_insert/has_and_belongs_to_many_override.rb

Instance Method Summary collapse

Instance Method Details

#has_and_belongs_to_many(name, *options) ⇒ Object

Decorate the original habtm to call our method definition

name - Plural name of the model we’re associating with options - see ActiveRecord docs. Rails 4+ allows an optional proc in addition to the params



7
8
9
10
11
# File 'lib/m2m_fast_insert/has_and_belongs_to_many_override.rb', line 7

def has_and_belongs_to_many(name, *options)
  super
  m2m_options = options.last.is_a?(Hash) ? options.last : {}
  define_fast_methods_for_model(name, m2m_options)
end