lib/rom/sql/associations/many_to_many.rb in rom-sql-2.1.0 vs lib/rom/sql/associations/many_to_many.rb in rom-sql-2.2.0
- old
+ new
@@ -1,13 +1,15 @@
require 'rom/associations/many_to_many'
require 'rom/sql/associations/core'
+require 'rom/sql/associations/self_ref'
module ROM
module SQL
module Associations
class ManyToMany < ROM::Associations::ManyToMany
include Associations::Core
+ include Associations::SelfRef
# @api public
def call(target: self.target)
left = join_assoc.(target: target)
@@ -20,11 +22,11 @@
end
else
target_schema
end.qualified
- relation = left.join(source.name.dataset, join_keys)
+ relation = left.join(source_table, join_keys)
if view
apply_view(schema, relation)
else
schema.(relation)
@@ -39,14 +41,9 @@
end
# @api public
def join_keys
{ source_attr => target_attr }
- end
-
- # @api public
- def source_attr
- source[source_key].qualified
end
# @api public
def target_attr
join_relation[target_key].qualified