Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Foo
- def self.to_mongo(value)
- # convert value to a mongo safe data type
- end
- def self.from_mongo(value)
- # convert value from a mongo safe data type to your custom data type
- end
- end
- class Thing
- include MongoMapper::Document
- key :name, Foo #Awesome
- key :count, Integer
- key :slug, String
- end
Add Comment
Please, Sign In to add comment