31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/gems/dm-timestamps-0.9.7/lib/dm-timestamps.rb', line 31
def timestamps(*args)
if args.empty? then raise ArgumentError, "You need to pass at least one argument." end
args.each do |ts|
case ts
when :at
property :created_at, DateTime
property :updated_at, DateTime
when :on
property :created_on, Date
property :updated_on, Date
else
unless TIMESTAMP_PROPERTIES.keys.include?(ts)
raise InvalidTimestampName, "Invalid timestamp property '#{ts}'."
end
property ts, DateTime
end
end
end
|