1
0
Fork 0
mirror of https://github.com/paper-trail-gem/paper_trail.git synced 2022-11-09 11:33:19 -05:00

fix PaperTrail::Rails::Controller.included method

remove "if" condition and make loading of Rails code conditional.

this bombed if the controller wasn't ActionController::Base and the rails-api gem wasn't included.
This commit is contained in:
Jordan Brough 2014-04-02 10:23:34 -06:00
parent ffd7bc233a
commit d93fe878a5
2 changed files with 3 additions and 5 deletions

View file

@ -121,7 +121,6 @@ end
require 'paper_trail/version'
# Require frameworks
require 'paper_trail/frameworks/rails'
require 'paper_trail/frameworks/sinatra'
require 'paper_trail/frameworks/rspec' if defined? RSpec
require 'paper_trail/frameworks/cucumber' if defined? World
@ -131,6 +130,7 @@ ActiveSupport.on_load(:active_record) do
end
if defined?(ActionController)
require 'paper_trail/frameworks/rails'
ActiveSupport.on_load(:action_controller) do
include PaperTrail::Rails::Controller
end

View file

@ -3,10 +3,8 @@ module PaperTrail
module Controller
def self.included(base)
if defined?(ActionController) && (base == ActionController::Base || base == ActionController::API)
base.before_filter :set_paper_trail_enabled_for_controller
base.before_filter :set_paper_trail_whodunnit, :set_paper_trail_controller_info
end
base.before_filter :set_paper_trail_enabled_for_controller
base.before_filter :set_paper_trail_whodunnit, :set_paper_trail_controller_info
end
protected