Sha256: d5e1332e50480b50c288c94289e375f9d4bcbc6f8457509a94d3885c47510bc0

Contents?: true

Size: 663 Bytes

Versions: 1

Compression:

Stored size: 663 Bytes

Contents

require 'load_speed'
require 'stopwatch_log'

module Stopwatch
  class Railtie < Rails::Railtie
    initializer "newplugin.initialize" do |app|
      app.config.middleware.use "Rack::LoadSpeed"

      ActiveSupport::Notifications.subscribe "start_processing.action_controller" do |*args|
        StopwatchLog.reset_query_count
      end

      ActiveSupport::Notifications.subscribe "process_action.action_controller" do |*args|
        StopwatchLog.event = ActiveSupport::Notifications::Event.new(*args)
      end

      ActiveSupport::Notifications.subscribe "sql.active_record" do |*args|
        StopwatchLog.increment_query_count
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stopwatch-0.0.1 lib/stopwatch.rb