lib/fast_timestamp.rb in fast_timestamp-0.0.2 vs lib/fast_timestamp.rb in fast_timestamp-0.0.3
- old
+ new
@@ -23,10 +23,12 @@
::Timestamp.exists? :timestampable_type => self.class.base_class.name, :timestampable_id => id, :key => key.to_s
end
# returns a Time object
def timestamp_for(key)
- ::Timestamp.find_by_timestampable_type_and_timestampable_id_and_key(self.class.base_class.name, id, key.to_s).read_attribute :stamped_at
+ if t = ::Timestamp.find_by_timestampable_type_and_timestampable_id_and_key(self.class.base_class.name, id, key.to_s)
+ t.read_attribute :stamped_at
+ end
end
def fast_destroy_timestamps
::Timestamp.destroy_all :timestampable_type => self.class.base_class.name, :timestampable_id => id
true