Sha256: 8111b51384f26dfb9e15be682e4166e05493022b1ebcd9c51a2db778692db5f8

Contents?: true

Size: 348 Bytes

Versions: 5

Compression:

Stored size: 348 Bytes

Contents

module ActiveRecord
  module Precount
    module ReflectionChecker
      class << self
        def has_reflection?(klass, name)
          klass.reflections[name.to_s].present?
        end

        def count_loaded?(owner, name)
          has_reflection?(owner.class, name) && owner.association(name).loaded?
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-precount-0.7.0 lib/active_record/precount/reflection_checker.rb
activerecord-precount-0.7.0.beta1 lib/active_record/precount/reflection_checker.rb
activerecord-precount-0.6.3 lib/active_record/precount/reflection_checker.rb
activerecord-precount-0.6.2 lib/active_record/precount/reflection_checker.rb
activerecord-precount-0.6.1 lib/active_record/precount/reflection_checker.rb