Sha256: 9035e58f82fc2cf0041b4c1f9539387e17c1226a0eeb52df7213a663ddc7fd71
Contents?: true
Size: 931 Bytes
Versions: 1
Compression:
Stored size: 931 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
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
track_changes-1.0.0.pre1 | lib/track_changes/action_controller.rb |