i was reading tutorials for rails 3 with mongodb
and i see something like this
# Note this: ids are of class ObjectId.
key :user_id, ObjectId
timestamps!
what does the exclamation mark mean???
Thanks.
class Story
include MongoMapper::Document
key :title, String
key :url, String
key :slug, String
key :voters, Array
key :votes, Integer, :default => 0
key :relevance, Integer, :default => 0
# Cached values.
key :comment_count, Integer, :default => 0
key :username, String
# Note this: ids are of class ObjectId.
key :user_id, ObjectId
timestamps!
# Relationships.
belongs_to :user
# Validations.
validates_presence_of :title, :url, :user_id
end
That’s defined in MongoMapper::Document:
https://github.com/jnunemaker/mongomapper/blob/master/lib/mongo_mapper/plugins/timestamps.rb