Sha256: 756163133e2da6957efe1af5d37486ecae7846c6f6be41906f6ed0dd6e6520d3
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
module Octoshark module ActiveRecordBase extend ActiveSupport::Concern included do class << self alias_method_chain :establish_connection, :octoshark end end module ClassMethods def establish_connection_with_octoshark(*args) establish_connection_without_octoshark(*args) Octoshark.reload! if Octoshark.configured? end end end module ActiveRecordLogSubscriber extend ActiveSupport::Concern included do alias_method_chain :debug, :octoshark end def debug_with_octoshark(msg) prefix = if Octoshark.configured? && Octoshark.current_connection_name color("[Octoshark: #{Octoshark.current_connection_name}]", ActiveSupport::LogSubscriber::GREEN, true) end debug_without_octoshark("#{prefix}#{msg}") end end end ActiveRecord::Base.send(:include, Octoshark::ActiveRecordBase) ActiveRecord::LogSubscriber.send(:include, Octoshark::ActiveRecordLogSubscriber)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
octoshark-0.0.5 | lib/octoshark/active_record_extensions.rb |