class Dart::ManyToManyAssociation
Attributes
left_ass[R]
right_ass[R]
Public Class Methods
new(left_ass, right_ass)
click to toggle source
for an m2m association on users we'd pass in:
left_ass: badge_users.user_id -> users.id right_ass: badge_users.badge_id -> badges.id
>¶ ↑
many_to_many :badges, join_table: :badge_users
# File lib/dart/core/many_to_many_association.rb, line 13 def initialize(left_ass, right_ass) @left_ass, @right_ass = left_ass, right_ass end
Public Instance Methods
associated_table()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 25 def associated_table right_ass.parent_table end
eql?(other)
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 41 def eql?(other) join_associations.eql? other.join_associations end
Also aliased as: ==
hash()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 46 def hash join_associations.hash end
join_associations()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 17 def join_associations [left_ass, right_ass] end
join_table()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 29 def join_table right_ass.child_table end
left_foreign_key()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 33 def left_foreign_key left_ass.foreign_key end
right_foreign_key()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 37 def right_foreign_key right_ass.foreign_key end
to_s()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 50 def to_s "#{self.class}\n left:#{left_ass}\n right:#{right_ass}" end
type()
click to toggle source
# File lib/dart/core/many_to_many_association.rb, line 21 def type MANY_TO_MANY_TYPE end