Class: Reactive::MetaModel::ActiveRecordModel::Association

Inherits:
Association
  • Object
show all
Defined in:
lib/activerecord_meta_model.rb

Instance Method Summary collapse

Constructor Details

#initialize(association) ⇒ Association

Returns a new instance of Association.



51
52
53
54
55
56
57
58
59
60
# File 'lib/activerecord_meta_model.rb', line 51

def initialize(association)
  @name, @kind, @klass = association.name.to_sym, association.macro, association.klass
  @polymorphic = association.options[:polymorphic]
  # TODO: has_* don't have attributes in their table, so avoid these attributes (they may clash with real attributes!)
  @columns = [
    association.primary_key_name,
    association.options[:foreign_type],
    association.counter_cache_column
  ].compact.map(&:to_sym)
end