Sha256: 463960813d6ffcb7d3f4b34bc209d01e39046c34b371532e3efb1baa632e8ec2
Contents?: true
Size: 660 Bytes
Versions: 11
Compression:
Stored size: 660 Bytes
Contents
require 'active_support/time' module CouchPotato module MagicTimestamps #:nodoc: def self.included(base) base.instance_eval do property :created_at, :type => Time property :updated_at, :type => Time before_create lambda {|model| model.created_at ||= (Time.zone || Time).now clear_attribute_changes [:created_at] model.updated_at ||= (Time.zone || Time).now clear_attribute_changes [:updated_at] } before_update lambda {|model| model.updated_at = (Time.zone || Time).now clear_attribute_changes [:updated_at] } end end end end
Version data entries
11 entries across 11 versions & 1 rubygems