Sha256: 733d19a92bc4a4faf109f5753e16f6ec434bc19f339cf2051de603ed3e0cac43

Contents?: true

Size: 661 Bytes

Versions: 16

Compression:

Stored size: 661 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
        "N+1 Query #{@path ? "in #{@path}" : 'detected'}"
      end

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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
bullet-5.4.3 lib/bullet/notification/n_plus_one_query.rb
bullet-5.4.2 lib/bullet/notification/n_plus_one_query.rb
bullet-5.4.1 lib/bullet/notification/n_plus_one_query.rb
bullet-5.4.0 lib/bullet/notification/n_plus_one_query.rb
bullet-5.3.0 lib/bullet/notification/n_plus_one_query.rb
bullet-5.2.1 lib/bullet/notification/n_plus_one_query.rb
bullet-5.2.0 lib/bullet/notification/n_plus_one_query.rb
bullet-5.1.1 lib/bullet/notification/n_plus_one_query.rb
bullet-5.1.0 lib/bullet/notification/n_plus_one_query.rb
bullet-5.0.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.14.10 lib/bullet/notification/n_plus_one_query.rb
bullet-4.14.9 lib/bullet/notification/n_plus_one_query.rb
bullet-4.14.8 lib/bullet/notification/n_plus_one_query.rb
bullet-4.14.7 lib/bullet/notification/n_plus_one_query.rb
bullet-4.14.6 lib/bullet/notification/n_plus_one_query.rb
bullet-4.14.5 lib/bullet/notification/n_plus_one_query.rb