Sha256: c1c4ea5c262991be4d8f31d6fb44d08d5d2b27cbe010e9f7e268874ae130fe49

Contents?: true

Size: 641 Bytes

Versions: 19

Compression:

Stored size: 641 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
        "#{body}\n#{call_stack_messages}"
      end

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

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

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

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
bullet-4.8.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.7.1 lib/bullet/notification/n_plus_one_query.rb
bullet-4.7.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.6.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.5.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.4.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.3.1 lib/bullet/notification/n_plus_one_query.rb
bullet-4.3.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.2.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.1.6 lib/bullet/notification/n_plus_one_query.rb
bullet-4.1.5 lib/bullet/notification/n_plus_one_query.rb
bullet-4.1.4 lib/bullet/notification/n_plus_one_query.rb
bullet-4.1.3 lib/bullet/notification/n_plus_one_query.rb
bullet-4.1.2 lib/bullet/notification/n_plus_one_query.rb
bullet-4.1.1 lib/bullet/notification/n_plus_one_query.rb
bullet-4.1.0 lib/bullet/notification/n_plus_one_query.rb
bullet-4.0.0 lib/bullet/notification/n_plus_one_query.rb
bullet-2.3.1 lib/bullet/notification/n_plus_one_query.rb
bullet-2.3.0 lib/bullet/notification/n_plus_one_query.rb