可能重複:
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