Sha256: 155b5e0c75c99d6dd5393ad68fcb38d58d6909b5fb2aa1d4f7ea4a7a48a8e9e7

Contents?: true

Size: 675 Bytes

Versions: 3

Compression:

Stored size: 675 Bytes

Contents

module Bullet
  module Notification
    class NPlusOneQuery < Base
      def initialize(callers, base_class, associations, path = nil)
        super(base_class, associations, path)

        @callers = callers
      end

      def body_with_caller
        markdown("#{body}\n#{call_stack_messages}")
      end

      def body
        "#{klazz_associations_str}\n  Add to your finder: #{associations_str}"
      end

      def title
        markdown(("##")+"N+1 Query #{@path ? "in #{@path}" : 'detected'}")
      end

      protected
        def call_stack_messages
          markdown((['N+1 Query method call stack'] + @callers).join( "\n  " ))
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bullet_instructure-4.0.5 lib/bullet/notification/n_plus_one_query.rb
bullet_instructure-4.0.3 lib/bullet/notification/n_plus_one_query.rb
bullet_instructure-4.0.2 lib/bullet/notification/n_plus_one_query.rb