Sha256: f6f6d968d0b32c5bb112faa9109c9bfa72135e5a763f12fc0f2c95d7139f9d9f

Contents?: true

Size: 667 Bytes

Versions: 8

Compression:

Stored size: 667 Bytes

Contents

# frozen_string_literal: true

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
        "USE eager loading #{@path ? "in #{@path}" : 'detected'}"
      end

      def notification_data
        super.merge(
          backtrace: []
        )
      end

      protected

      def call_stack_messages
        (['Call stack'] + @callers).join("\n  ")
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
bullet-6.0.2 lib/bullet/notification/n_plus_one_query.rb
bullet-6.0.1 lib/bullet/notification/n_plus_one_query.rb
bullet-6.0.0 lib/bullet/notification/n_plus_one_query.rb
bullet-5.9.0 lib/bullet/notification/n_plus_one_query.rb
bullet-5.8.1 lib/bullet/notification/n_plus_one_query.rb
bullet-5.8.0 lib/bullet/notification/n_plus_one_query.rb
bullet-5.7.6 lib/bullet/notification/n_plus_one_query.rb
bullet-5.7.5 lib/bullet/notification/n_plus_one_query.rb