Sha256: 1cb926fa80ecc8265cd98a9111bf140f1e52dae66859b55dffaee72cb722a10f

Contents?: true

Size: 425 Bytes

Versions: 34

Compression:

Stored size: 425 Bytes

Contents

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.now; model.created_at_not_changed}
        before_save lambda {|model| model.updated_at = Time.now; model.updated_at_not_changed}
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 4 rubygems

Version Path
couch_potato-0.2.25 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.24 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.23 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.22 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.21 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.20 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.19 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.18 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.17 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.16 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.15 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.14 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.13 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.12 lib/couch_potato/persistence/magic_timestamps.rb