Sha256: 089c38c35b7d273565f071b02aed218c78af86aaa5e40f19bebf8c0fd146d81b

Contents?: true

Size: 668 Bytes

Versions: 1

Compression:

Stored size: 668 Bytes

Contents

module Datagrid
  module Drivers
    class Mongoid < AbstractDriver

      def self.match?(scope)
        return false unless defined?(::Mongoid)
        if scope.is_a?(Class) 
          scope.ancestors.include?(::Mongoid::Document)
        else
          scope.is_a?(::Mongoid::Criteria)
        end
      end

      def to_scope(scope)
        scope.where
      end

      def where(scope, condition)
        scope.where(condition)
      end

      def asc(scope, order)
        scope.asc(order)
      end

      def desc(scope, order)
        scope.desc(order)
      end

      def default_order(scope, column_name)
        column_name
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datagrid-0.5.0 lib/datagrid/drivers/mongoid.rb