Sha256: acba077d00d929bb7222fee94e4f1aa8b04559e940b1520da4be35b4d5b25b57

Contents?: true

Size: 688 Bytes

Versions: 2

Compression:

Stored size: 688 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
        "#{klazz_associations_str}\n  Add to your finder: #{associations_str}"
      end

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

      def notification_data
        super.merge(
          :backtrace => @callers
        )
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bullet_instructure-4.14.8 lib/bullet/notification/n_plus_one_query.rb
bullet_instructure-4.14.7 lib/bullet/notification/n_plus_one_query.rb