Sha256: 2595e7cb5869df9ebbf2e5137098a1cc766e90d7fe228dbee8a1296a011d0695

Contents?: true

Size: 484 Bytes

Versions: 6

Compression:

Stored size: 484 Bytes

Contents

# frozen_string_literal: true
module Kasket
  module RelationMixin
    def to_kasket_query(binds = nil)
      if arel.is_a?(Arel::SelectManager)
        if ActiveRecord::VERSION::MAJOR < 5
          arel.to_kasket_query(klass, (binds || bind_values))
        else
          arel.to_kasket_query(klass, (@values[:where].binds.map(&:value_for_database) + Array(@values[:limit])))
        end
      end
    rescue TypeError # unsupported object in ast
      return nil
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kasket-4.7.0 lib/kasket/relation_mixin.rb
kasket-4.6.0 lib/kasket/relation_mixin.rb
kasket-4.5.1 lib/kasket/relation_mixin.rb
kasket-4.5.0 lib/kasket/relation_mixin.rb
kasket-4.4.5 lib/kasket/relation_mixin.rb
kasket-4.4.4 lib/kasket/relation_mixin.rb