lib/joiner/join_dependency.rb in joiner-0.4.1 vs lib/joiner/join_dependency.rb in joiner-0.4.2
- old
+ new
@@ -1,8 +1,11 @@
class Joiner::JoinDependency < ActiveRecord::Associations::JoinDependency
- def join_association_for(path, alias_tracker)
- @alias_tracker = alias_tracker
- construct_tables! join_root
+ def join_association_for(path, alias_tracker = nil)
+ if alias_tracker
+ # ActiveRecord 5.2.1+
+ @alias_tracker = alias_tracker
+ construct_tables! join_root
+ end
path.inject(join_root) do |node, piece|
node.children.detect { |child| child.reflection.name == piece }
end
end