Sha256: 3af873c29f694756a7a9977d5c6dac8eb0f22a5f16ad65c58e92ecaea4011714
Contents?: true
Size: 769 Bytes
Versions: 9
Compression:
Stored size: 769 Bytes
Contents
module CortexReaver module Model # Supports updated_on and created_on behavior module Timestamps def self.included(base) base.class_eval do # Create before_create(:init_timestamp) do unless skip_timestamp_update? self.created_on = Time.now self.updated_on = Time.now end end # Update before_update(:update_timestamp) do unless skip_timestamp_update? self.updated_on = Time.now end end end end def skip_timestamp_update=(boolean) @skip_timestamp_update = boolean end def skip_timestamp_update? @skip_timestamp_update end end end end
Version data entries
9 entries across 9 versions & 1 rubygems