Sha256: 769492ec27b1a3dcfbaeb57d7c1c1e66c630c452acbeaf4ad6c87133261cbb70
Contents?: true
Size: 1003 Bytes
Versions: 2
Compression:
Stored size: 1003 Bytes
Contents
module TrackChanges module ActionController #:nodoc: def self.included(base) base.send :extend, ClassMethods end module ClassMethods # Sets up an around filter to assign the controller's <tt>current_user</tt> # to the given model names that are already set as instance variables in a # prior <tt>before_filter</tt>. # # Example: # # track_changes :post # track_changes :post, :post_attribute # # Currently does not work if the instance variable is anything except # an model that has <tt>current_user</tt> accessors. def track_changes models models_to_track = [models].flatten define_method(:__track_changes_to_models) { models_to_track } self.class_eval do helper :audits before_filter TrackChanges::CurrentUserFilter end end end end end ActionController::Base.send :include, TrackChanges::ActionController
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
track_changes-1.0.0.pre3 | lib/track_changes/action_controller.rb |
track_changes-1.0.0.pre2 | lib/track_changes/action_controller.rb |