Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Now fails with more accurate "uninitialized constant ActiveRecord" if…

… ActiveRecord not defined

Previously failed with "uninitialized constant Oink::Middleware::ActiveRecord"
  • Loading branch information...
commit 0198645fc60f16994b6067308eae171e83a87af9 1 parent 78d0371
@noahd1 authored
View
6 lib/oink/instrumentation/active_record.rb
@@ -8,6 +8,12 @@ def self.extended_active_record!
@oink_extended_active_record = true
end
+ def self.extend_active_record!
+ ::ActiveRecord::Base.class_eval do
+ include Instrumentation::ActiveRecord
+ end
+ end
+
module Instrumentation
module ActiveRecord
View
2  lib/oink/middleware.rb
@@ -10,7 +10,7 @@ def initialize(app, options = {})
@logger = options[:logger] || Hodel3000CompliantLogger.new("log/oink.log")
@instruments = options[:instruments] ? Array(options[:instruments]) : [:memory, :activerecord]
- ActiveRecord::Base.send(:include, Oink::Instrumentation::ActiveRecord) if @instruments.include?(:activerecord)
+ Oink.extend_active_record! if @instruments.include?(:activerecord)
end
def call(env)
Please sign in to comment.
Something went wrong with that request. Please try again.