Sha256: efa8037711f7b77e666e516f05ce71161bd1787c6ad3e33aafd6aa609ed4893c

Contents?: true

Size: 939 Bytes

Versions: 28

Compression:

Stored size: 939 Bytes

Contents

require 'active_support/core_ext/module/attr_internal'

module Rails
  module Sequel
    module Railties

      module ControllerRuntime

        extend ActiveSupport::Concern

        protected

        attr_internal :db_runtime

        def cleanup_view_runtime
          db_rt_before_render = ::Rails::Sequel.reset_runtime
          runtime = super
          db_rt_after_render = ::Rails::Sequel.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
end

Version data entries

28 entries across 28 versions & 5 rubygems

Version Path
vizzuality-sequel-rails-0.3.7 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.10 lib/sequel-rails/railties/controller_runtime.rb
vizzuality-sequel-rails-0.3.6 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.9 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.8 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.7 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.6 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.5 lib/sequel-rails/railties/controller_runtime.rb
vizzuality-sequel-rails-0.3.5 lib/sequel-rails/railties/controller_runtime.rb
vizzuality-sequel-rails-0.3.4 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.4 lib/sequel-rails/railties/controller_runtime.rb
sequel-rails-cartodb-0.1.7 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.3 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.2 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.1 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.3.0 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.2.3 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.2.2 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.2.1 lib/sequel-rails/railties/controller_runtime.rb
talentbox-sequel-rails-0.2.0 lib/sequel-rails/railties/controller_runtime.rb