Class: ActiveSchema::Associations::ByForeignKey

Inherits:
Object
  • Object
show all
Includes:
Naming
Defined in:
lib/active_schema/associations/by_foreign_key.rb

Direct Known Subclasses

ByForwardForeignKey, ByReverseForeignKey

Instance Method Summary collapse

Methods included from Naming

#name_for, #plural_name_for

Constructor Details

#initialize(from_model, to_model, key_column, key_column_unique) ⇒ ByForeignKey

Returns a new instance of ByForeignKey.



14
15
16
17
18
19
# File 'lib/active_schema/associations/by_foreign_key.rb', line 14

def initialize(from_model, to_model, key_column, key_column_unique)
  @from_model = from_model
  @to_model = to_model
  @key_column = key_column
  @key_column_unique = key_column_unique
end

Instance Method Details

#association(receiver, method_name, name, opts = {}) ⇒ Object



21
22
23
# File 'lib/active_schema/associations/by_foreign_key.rb', line 21

def association(receiver, method_name, name, opts = {})
  receiver.send(method_name, name, opts)
end