可能重复:
Why are exclamation marks used in Ruby methods?感叹号在轨道上的红宝石中的变量意味着什么?
我读教程Rails3中使用MongoDB的
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”...为什么? – 2011-06-07 04:25:11
如果有人想知道什么时间戳!是为: http://mongomapper.com/documentation/plugins/timestamps.html – dsims 2012-05-26 04:03:43