Sha256: 8c6a514d70a02ff5574794f31e506b50613a17bd65bc41c9d23e56835c7e22c8

Contents?: true

Size: 918 Bytes

Versions: 13

Compression:

Stored size: 918 Bytes

Contents

require "active_support/core_ext/module/attr_internal"

module SequelRails
  module Railties

    module ControllerRuntime

      extend ActiveSupport::Concern

      protected

      attr_internal :db_runtime

      def cleanup_view_runtime
        db_rt_before_render = ::SequelRails::Railties::LogSubscriber.reset_runtime
        runtime = super
        db_rt_after_render = ::SequelRails::Railties::LogSubscriber.reset_runtime
        self.db_runtime = db_rt_before_render + db_rt_after_render
        runtime - db_rt_after_render
      end

      def append_info_to_payload(payload)
        super
        payload[:db_runtime] = db_runtime
      end

      module ClassMethods

        def log_process_action(payload)
          messages, db_runtime = super, payload[:db_runtime]
          messages << ("Models: %.1fms" % db_runtime.to_f) if db_runtime
          messages
        end

      end

    end

  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
sequel-rails-0.7.0 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.6.1 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.6.0 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.5.1 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.5.0 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.4 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.3 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.2 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.1 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.0 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.0.pre2 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.0.pre1 lib/sequel_rails/railties/controller_runtime.rb
sequel-rails-0.4.0.pre lib/sequel_rails/railties/controller_runtime.rb