lib/new_relic/control/frameworks/rails.rb in newrelic_rpm-3.5.0.1 vs lib/new_relic/control/frameworks/rails.rb in newrelic_rpm-3.5.1.alpha
- old
+ new
@@ -43,12 +43,12 @@
DependencyDetection.detect!
end
end
if !Agent.config[:agent_enabled]
# Might not be running if it does not think mongrel, thin, passenger, etc
- # is running, if it things it's a rake task, or if the agent_enabled is false.
- log! "New Relic Agent not running."
+ # is running, if it thinks it's a rake task, or if the agent_enabled is false.
+ log!("New Relic Agent not running.", :debug)
else
log! "Starting the New Relic Agent."
install_developer_mode rails_config if Agent.config[:developer_mode]
install_browser_monitoring(rails_config)
end
@@ -156,12 +156,14 @@
end
def install_shim
super
require 'new_relic/agent/instrumentation/controller_instrumentation'
- ::ActionController::Base.class_eval {
- include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim
- }
+ if ActiveSupport.respond_to?(:on_load) # rails 3+
+ ActiveSupport.on_load(:action_controller) { include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim }
+ else
+ ActionController::Base.class_eval { include NewRelic::Agent::Instrumentation::ControllerInstrumentation::Shim }
+ end
end
end
end
end