Class: Torque::PostgreSQL::Reflection::BelongsToManyReflection

Inherits:
ActiveRecord::Reflection::AssociationReflection
  • Object
show all
Defined in:
lib/torque/postgresql/reflection/belongs_to_many_reflection.rb

Instance Method Summary collapse

Instance Method Details

#active_record_primary_keyObject



35
36
37
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 35

def active_record_primary_key
  @active_record_primary_key ||= options[:primary_key]&.to_s || derive_primary_key
end

#association_classObject



23
24
25
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 23

def association_class
  Associations::BelongsToManyAssociation
end

#association_foreign_keyObject



31
32
33
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 31

def association_foreign_key
  @association_foreign_key ||= foreign_key
end

#belongs_to?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 15

def belongs_to?
  true
end

#collection?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 19

def collection?
  true
end

#connected_through_array?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 11

def connected_through_array?
  true
end

#foreign_keyObject



27
28
29
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 27

def foreign_key
  @foreign_key ||= options[:foreign_key]&.to_s || derive_foreign_key.freeze
end

#join_foreign_keyObject



43
44
45
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 43

def join_foreign_key
  foreign_key
end

#join_primary_keyObject



39
40
41
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 39

def join_primary_key(*)
  active_record_primary_key
end

#macroObject



7
8
9
# File 'lib/torque/postgresql/reflection/belongs_to_many_reflection.rb', line 7

def macro
  :belongs_to_many
end