Skip to content

Instantly share code, notes, and snippets.

@rafer
Created December 29, 2011 22:21
Show Gist options
  • Save rafer/1536460 to your computer and use it in GitHub Desktop.
Save rafer/1536460 to your computer and use it in GitHub Desktop.
class Thing
include Mongoid::Document
field :integer_field, :type => Integer
field :big_decimal_field, :type => BigDecimal
field :date_field, :type => Date
end
thing = Thing.new
thing.integer_field = "WRONG" # Stores the string "WRONG"
thing.big_decimal_field = "WRONG" # Stores the BigDecimal equivalent of 0.0
thing.date_field = "WRONG" # Throws Mongoid::Errors::InvalidTime:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment