Skip to content

Commit

Permalink
disable versioning, timestamp callbacks patch
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Ronai authored and Mark Ronai committed Sep 20, 2010
1 parent 1a06b10 commit daa8350
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/mongoid/timestamps.rb
Expand Up @@ -6,7 +6,8 @@ module Timestamps
field :created_at, :type => Time
field :updated_at, :type => Time
set_callback :create, :before, :set_created_at
set_callback :save, :before, :set_updated_at
attr_accessor :_skip_timestamps
set_callback :save, :before, :set_updated_at, :unless => Proc.new {|p| p._skip_timestamps}

class_inheritable_accessor :record_timestamps, :instance_writer => false
self.record_timestamps = true
Expand Down
3 changes: 2 additions & 1 deletion lib/mongoid/versioning.rb
Expand Up @@ -9,7 +9,8 @@ module Versioning
included do
field :version, :type => Integer, :default => 1
embeds_many :versions, :class_name => self.name
set_callback :save, :before, :revise
attr_accessor :_skip_versioning
set_callback :save, :before, :revise, :unless => Proc.new {|p| p._skip_versioning}
end

module ClassMethods #:nodoc:
Expand Down

0 comments on commit daa8350

Please sign in to comment.