Sha256: 18f1b5281eb7433d63366d2269fe421d579d62a5d6eb448a55b6698d836820f2

Contents?: true

Size: 425 Bytes

Versions: 6

Compression:

Stored size: 425 Bytes

Contents

# frozen_string_literal: true
module Kasket
  module RelationMixin
    def to_kasket_query
      if arel.is_a?(Arel::SelectManager)
        if ActiveRecord::VERSION::STRING < '5.2'
          arel.to_kasket_query(klass, (@values[:where].to_h.values + Array(@values[:limit])))
        else
          arel.to_kasket_query(klass)
        end
      end
    rescue TypeError # unsupported object in ast
      nil
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
kasket-4.14.2 lib/kasket/relation_mixin.rb
kasket-4.14.1 lib/kasket/relation_mixin.rb
kasket-4.14.0 lib/kasket/relation_mixin.rb
kasket-4.13.0 lib/kasket/relation_mixin.rb
kasket-4.12.0 lib/kasket/relation_mixin.rb
kasket-4.11.0 lib/kasket/relation_mixin.rb