Class: ActiveRecord::Reflection::PolymorphicReflection

Inherits:
AbstractReflection show all
Defined in:
activerecord/lib/active_record/reflection.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods inherited from AbstractReflection

#alias_candidate, #build_association, #build_scope, #chain, #check_validity_of_inverse!, #class_name, #counter_cache_column, #counter_must_be_updated_by_has_many?, #get_join_keys, #has_cached_counter?, #inverse_of, #inverse_updates_counter_in_memory?, #inverse_which_updates_counter_cache, #join_foreign_key, #join_keys, #join_primary_key, #join_scope, #klass_join_scope, #scopes, #table_name, #through_reflection?

Constructor Details

#initialize(reflection, previous_reflection) ⇒ PolymorphicReflection

Returns a new instance of PolymorphicReflection.



1009
1010
1011
1012
# File 'activerecord/lib/active_record/reflection.rb', line 1009

def initialize(reflection, previous_reflection)
  @reflection = reflection
  @previous_reflection = previous_reflection
end

Instance Method Details

#constraintsObject



1019
1020
1021
# File 'activerecord/lib/active_record/reflection.rb', line 1019

def constraints
  @reflection.constraints + [source_type_scope]
end

#join_scopes(table, predicate_builder) ⇒ Object

:nodoc:



1014
1015
1016
1017
# File 'activerecord/lib/active_record/reflection.rb', line 1014

def join_scopes(table, predicate_builder) # :nodoc:
  scopes = @previous_reflection.join_scopes(table, predicate_builder) + super
  scopes << build_scope(table, predicate_builder).instance_exec(nil, &source_type_scope)
end