我有一个类Event,我需要一个方法来比较当前日期和Event创建日期。你能告诉我如何访问为Event数据库表创建的脚手架的created_at时间戳吗?RoR:如何获取模型中的创建时间戳
class Event < ActiveRecord::Base
attr_accessible :location, :name
def isInsertedLongAgo
# current date - insertion date >= 90 days
end
end
如果你想遵循标准的Ruby约定,你应该命名方法'inserted_long_ago?'。 –