Class: LolDba::HasAndBelongsToMany

Inherits:
RelationInspector show all
Defined in:
lib/lol_dba/index_finding/has_and_belongs_to_many.rb

Instance Attribute Summary

Attributes inherited from RelationInspector

#model_class, #reflection_name, #reflection_options

Instance Method Summary collapse

Methods inherited from RelationInspector

#get_through_foreign_key, #initialize, #reflections

Constructor Details

This class inherits a constructor from LolDba::RelationInspector

Instance Method Details

#relation_columnsObject



3
4
5
6
# File 'lib/lol_dba/index_finding/has_and_belongs_to_many.rb', line 3

def relation_columns
  foreign_key = get_through_foreign_key(model_class, reflection_options)
  index_name = [association_fk, foreign_key].map(&:to_s).sort
end

#table_nameObject



8
9
10
11
# File 'lib/lol_dba/index_finding/has_and_belongs_to_many.rb', line 8

def table_name
  table_name = reflection_options.options[:join_table]
  table_name || [model_class.table_name, reflection_name.to_s].sort.join('_')
end