Sha256: 30e4e52b967670fb40af278bfea92da41ad3f27a1cabbfa7f808c0c9f9f27b33

Contents?: true

Size: 839 Bytes

Versions: 3

Compression:

Stored size: 839 Bytes

Contents

require "rubygems"
require 'mongoid'


Mongoid.from_hash({
  "host" => "localhost",
  "database" =>"datagrid_mongoid",
  "autocreate_indexes" => true,
})

#Mongoid.logger = TEST_LOGGER #TODO: understand why still output to STDOUT
Mongoid.logger = nil


class MongoidEntry

  include Mongoid::Document
  include Mongoid::Timestamps

  field :group_id, :type => Integer
  field :name, :type => String
  field :category, :type => String
  field :disabled, :default => false, :type => Boolean
  field :confirmed, :default => false, :type => Boolean
  field :shipping_date, :type => DateTime

end

class MongoidGrid
  include ::Datagrid

  scope do
    MongoidEntry
  end

  filter :name
  filter :group_id do |value|
    where(:group_id => value)
  end
  filter :disabled, :eboolean

  column :name
  column :group_id
  column :disabled

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
datagrid-0.5.0 spec/support/mongoid.rb
datagrid-0.4.1 spec/support/mongoid.rb
datagrid-0.4.0 spec/support/mongoid.rb