Class: Sortiri::ActiveRecord::ForeignColumn
- Defined in:
- lib/sortiri/active_record/foreign_column.rb
Instance Attribute Summary
Attributes inherited from Column
Instance Method Summary collapse
- #foreign_key ⇒ Object
-
#initialize(name:, model:, association_name:) ⇒ ForeignColumn
constructor
A new instance of ForeignColumn.
- #table_name ⇒ Object
Methods inherited from Column
#matches_with?, #name_with_table_name
Constructor Details
#initialize(name:, model:, association_name:) ⇒ ForeignColumn
Returns a new instance of ForeignColumn.
6 7 8 |
# File 'lib/sortiri/active_record/foreign_column.rb', line 6 def initialize(name:, model:, association_name:) super(name: name, model: model, association_name: association_name) end |
Instance Method Details
#foreign_key ⇒ Object
10 11 12 |
# File 'lib/sortiri/active_record/foreign_column.rb', line 10 def foreign_key @model.reflect_on_association(association_name).foreign_key end |
#table_name ⇒ Object
14 15 16 |
# File 'lib/sortiri/active_record/foreign_column.rb', line 14 def table_name @model.reflect_on_association(association_name).table_name end |