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
andrewtimberlake-couch_potato-0.2.8.1 lib/couch_potato/persistence/magic_timestamps.rb
andrewtimberlake-couch_potato-0.2.8.2 lib/couch_potato/persistence/magic_timestamps.rb
andrewtimberlake-couch_potato-0.2.8.3 lib/couch_potato/persistence/magic_timestamps.rb
andrewtimberlake-couch_potato-0.2.8.4 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.11 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.12 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.3 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.4 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.5 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.6 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.7 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.8 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.9 lib/couch_potato/persistence/magic_timestamps.rb
thefool808-couch_potato-0.2.7 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.31 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.30 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.29 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.28 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.27 lib/couch_potato/persistence/magic_timestamps.rb
couch_potato-0.2.26 lib/couch_potato/persistence/magic_timestamps.rb