1
0
Fork 0
mirror of https://github.com/activerecord-hackery/ransack.git synced 2022-11-09 13:47:45 -05:00
activerecord-hackery--ransack/lib/polyamorous.rb

25 lines
945 B
Ruby
Raw Normal View History

2018-06-23 13:00:21 -04:00
if defined?(::ActiveRecord)
module Polyamorous
InnerJoin = Arel::Nodes::InnerJoin
OuterJoin = Arel::Nodes::OuterJoin
2018-06-23 13:00:21 -04:00
JoinDependency = ::ActiveRecord::Associations::JoinDependency
JoinAssociation = ::ActiveRecord::Associations::JoinDependency::JoinAssociation
2018-06-23 13:00:21 -04:00
end
require 'polyamorous/tree_node'
require 'polyamorous/join'
require 'polyamorous/swapping_reflection_class'
ar_version = ::ActiveRecord::VERSION::STRING[0,3]
ar_version = ::ActiveRecord::VERSION::STRING[0,5] if ar_version >= '5.2'
2018-06-23 13:00:21 -04:00
%w(join_association join_dependency).each do |file|
2018-07-02 11:00:34 -04:00
require "polyamorous/activerecord_#{ar_version}_ruby_2/#{file}"
2018-06-23 13:00:21 -04:00
end
2018-07-02 11:00:34 -04:00
Polyamorous::JoinDependency.send(:prepend, Polyamorous::JoinDependencyExtensions)
Polyamorous::JoinDependency.singleton_class.send(:prepend, Polyamorous::JoinDependencyExtensions::ClassMethods)
Polyamorous::JoinAssociation.send(:prepend, Polyamorous::JoinAssociationExtensions)
2018-06-23 13:00:21 -04:00
end