Module: PaperTrail::Rails::Controller
- Defined in:
- lib/paper_trail/frameworks/rails/controller.rb
Overview
Extensions to rails controllers. Provides convenient ways to pass certain information to the model layer, with controller_info and whodunnit. Also includes a convenient on/off switch, enabled_for_controller.
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/paper_trail/frameworks/rails/controller.rb', line 7 def self.included(base) before = [ :set_paper_trail_enabled_for_controller, :set_paper_trail_controller_info ] after = [ :warn_about_not_setting_whodunnit ] if base.respond_to? :before_action # Rails 4+ before.map { |sym| base.before_action sym } after.map { |sym| base.after_action sym } else # Rails 3. before.map { |sym| base.before_filter sym } after.map { |sym| base.after_filter sym } end end |