Sha256: db7a6c6994017a5943e0ece789fa7ec05a4c9ab475863347275fa629385646b8

Contents?: true

Size: 416 Bytes

Versions: 5

Compression:

Stored size: 416 Bytes

Contents

module CouchPotato
  module MagicTimestamps
    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

5 entries across 5 versions & 2 rubygems

Version Path
langalex-couch_potato-0.2.0 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.1 lib/couch_potato/persistence/magic_timestamps.rb
langalex-couch_potato-0.2.2 lib/couch_potato/persistence/magic_timestamps.rb
speedmax-couch_potato-0.2.0 lib/couch_potato/persistence/magic_timestamps.rb
speedmax-couch_potato-0.2.2 lib/couch_potato/persistence/magic_timestamps.rb