Module: ActiveRecord::Precount::BaseExtension

Defined in:
lib/active_record/precount/base_extension.rb

Instance Method Summary collapse

Instance Method Details

#has_reflection?(name) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/active_record/precount/base_extension.rb', line 6

def has_reflection?(name)
  reflection_for(name).present?
end

#reflection_for(name) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/active_record/precount/base_extension.rb', line 10

def reflection_for(name)
  if ActiveRecord::VERSION::MAJOR >= 4 && ActiveRecord::VERSION::MINOR >= 2
    reflections[name.to_s]
  else
    reflections[name.to_sym]
  end
end