Class: LolDba::BelongsTo
- Inherits:
-
RelationInspector
- Object
- RelationInspector
- LolDba::BelongsTo
- Defined in:
- lib/lol_dba/index_finding/belongs_to.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_columns ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/lol_dba/index_finding/belongs_to.rb', line 3 def relation_columns if .[:polymorphic] name = .name poly_type = "#{name}_type" poly_id = "#{name}_id" [poly_type, poly_id].sort else foreign_key = non_polymorphic_fk # not a clue why rails 4.1+ creates this left_side_id thing foreign_key == 'left_side_id' ? nil : foreign_key.to_s end end |
#table_name ⇒ Object
17 18 19 |
# File 'lib/lol_dba/index_finding/belongs_to.rb', line 17 def table_name model_class.table_name end |