Sha256: f23898c4ca98d246cb2191cf9c6058736cd592e826c5ee942c40a014eb790c7e

Contents?: true

Size: 945 Bytes

Versions: 4

Compression:

Stored size: 945 Bytes

Contents

module PolyamorousHelper
  if ActiveRecord::VERSION::STRING >= "4.1"
    def new_join_association(reflection, children, klass)
      Polyamorous::JoinAssociation.new reflection, children, klass
    end
  else
    def new_join_association(reflection, join_dependency, parent, klass)
      Polyamorous::JoinAssociation.new reflection, join_dependency, parent, klass
    end
  end

  if ActiveRecord::VERSION::STRING >= "5.2"
    def new_join_dependency(klass, associations = {})
      alias_tracker = ::ActiveRecord::Associations::AliasTracker.create(klass.connection, klass.table_name, [])
      Polyamorous::JoinDependency.new klass, klass.arel_table, associations, alias_tracker
    end
  else
    def new_join_dependency(klass, associations = {})
      Polyamorous::JoinDependency.new klass, associations, []
    end
  end

  def new_join(name, type = Polyamorous::InnerJoin, klass = nil)
    Polyamorous::Join.new name, type, klass
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
ransack-1.8.10 spec/helpers/polyamorous_helper.rb
ransack-1.8.9 spec/helpers/polyamorous_helper.rb
polyamorous-1.3.3 spec/helpers/polyamorous_helper.rb
polyamorous-1.3.2 spec/helpers/polyamorous_helper.rb