【发布时间】:2011-09-09 18:33:02
【问题描述】:
我正在阅读使用 MongoDB 的 Rails3 教程
http://www.mongodb.org/display/DOCS/MongoDB+Data+Modeling+and+Rails
我看到了 键:user_id,ObjectId 时间戳! 感叹号是什么意思??
谢谢。
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
【问题讨论】:
-
这被标记为
excel和syncfusion...为什么? -
如果有人想知道什么时间戳!用于:mongomapper.com/documentation/plugins/timestamps.html
标签: ruby ruby-on-rails-3 mongomapper