Skip to content

Instantly share code, notes, and snippets.

@djbender
Created February 15, 2013 15:46
Show Gist options
  • Save djbender/4961205 to your computer and use it in GitHub Desktop.
Save djbender/4961205 to your computer and use it in GitHub Desktop.
this is in Mongoid 2ish.
require 'mongoid'
class Foo
include Mongoid::Document
field :bar, :type => String
validates_uniquness_of :bar
end
foo = Foo.new
foo.valid?
# => MONGODB (0ms) foo['$cmd'].find({:ismaster=>1}).limit(-1) │
# TypeError: db_name must be a string or symbol
require 'mongoid'
class Foo
include Mongoid::Document
field :bar, :type => String
end
foo = Foo.new
foo.valid? # => true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment