Sha256: b52618de52d97a102941edd9226d0f5ccc99d511bf85148e54cb432aeb0332f5
Contents?: true
Size: 554 Bytes
Versions: 33
Compression:
Stored size: 554 Bytes
Contents
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) require 'mongo_mapper' require 'pp' MongoMapper.database = 'testing' class DowncasedString # to_mongo gets called anytime a value is assigned def self.to_mongo(value) value.nil? ? nil : value.to_s.downcase end # from mongo gets called anytime a value is read def self.from_mongo(value) value.nil? ? nil : value.to_s.downcase end end class User include MongoMapper::Document key :email, DowncasedString end pp User.create(:email => 'IDontLowerCaseThings@gmail.com')
Version data entries
33 entries across 33 versions & 7 rubygems