Class: ActiveRecord::Reflection::PolymorphicReflection

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

Overview

:nodoc:

Direct Known Subclasses

RuntimeReflection

Instance Method Summary collapse

Methods inherited from AbstractReflection

#alias_candidate, #build_association, #build_join_constraint, #build_scope, #chain, #check_validity_of_inverse!, #class_name, #counter_cache_column, #counter_must_be_updated_by_has_many?, #has_cached_counter?, #inverse_of, #inverse_updates_counter_in_memory?, #inverse_which_updates_counter_cache, #join_foreign_key, #join_keys, #join_scope, #klass_join_scope, #primary_key_type, #quoted_table_name, #scope_chain, #table_name, #through_reflection?

Constructor Details

#initialize(reflection, previous_reflection) ⇒ PolymorphicReflection

Returns a new instance of PolymorphicReflection.



1032
1033
1034
1035
# File 'activerecord/lib/active_record/reflection.rb', line 1032

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

Instance Method Details

#constraintsObject



1063
1064
1065
# File 'activerecord/lib/active_record/reflection.rb', line 1063

def constraints
  @reflection.constraints + [source_type_info]
end

#get_join_keys(association_klass) ⇒ Object



1067
1068
1069
# File 'activerecord/lib/active_record/reflection.rb', line 1067

def get_join_keys(association_klass)
  @reflection.get_join_keys(association_klass)
end

#join_scopes(table, predicate_builder) ⇒ Object

:nodoc:



1042
1043
1044
1045
# File 'activerecord/lib/active_record/reflection.rb', line 1042

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

#klassObject



1047
1048
1049
# File 'activerecord/lib/active_record/reflection.rb', line 1047

def klass
  @reflection.klass
end

#plural_nameObject



1055
1056
1057
# File 'activerecord/lib/active_record/reflection.rb', line 1055

def plural_name
  @reflection.plural_name
end

#scopeObject



1051
1052
1053
# File 'activerecord/lib/active_record/reflection.rb', line 1051

def scope
  @reflection.scope
end

#scopesObject



1037
1038
1039
1040
# File 'activerecord/lib/active_record/reflection.rb', line 1037

def scopes
  scopes = @previous_reflection.scopes
  scopes << @previous_reflection.source_type_scope
end

#typeObject



1059
1060
1061
# File 'activerecord/lib/active_record/reflection.rb', line 1059

def type
  @reflection.type
end