Sha256: b248ef484e67c36b4c6ac37e34592f09cf53b38bae915eee95471974d35ad28c
Contents?: true
Size: 725 Bytes
Versions: 3
Compression:
Stored size: 725 Bytes
Contents
module Mongoid::History class Sweeper < Mongoid::Observer attr_accessor :controller def self.observed_classes [Mongoid::History.tracker_class] end def before(controller) self.controller = controller true # before method from sweeper should always return true end def after(controller) self.controller = controller # Clean up, so that the controller can be collected after this request self.controller = nil end def before_create(track) track.modifier ||= current_user end def current_user controller.send Mongoid::History.current_user_method if controller.respond_to?(Mongoid::History.current_user_method, true) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-history-0.1.7 | lib/mongoid/history/sweeper.rb |
mongoid-history-0.1.6 | lib/mongoid/history/sweeper.rb |
mongoid-history-0.1.5 | lib/mongoid/history/sweeper.rb |