Sha256: e4983427e80276568528c280a48e0f494acc7dfd53ec260e933d3711f34830b8

Contents?: true

Size: 620 Bytes

Versions: 2

Compression:

Stored size: 620 Bytes

Contents

module Datagrid
  module Drivers
    class Mongoid < AbstractDriver

      def self.match?(scope)
        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

2 entries across 2 versions & 1 rubygems

Version Path
datagrid-0.4.1 lib/datagrid/drivers/mongoid.rb
datagrid-0.4.0 lib/datagrid/drivers/mongoid.rb