Class: ActiveRecord::Reflection::PolymorphicReflection
Overview
Instance Attribute Summary
#delegate_reflection
Instance Method Summary
collapse
#add_as_polymorphic_through, #add_as_source, #add_as_through, #association_primary_key, #check_validity!, #clear_association_scope_cache, #collect_join_chain, #collect_join_reflections, #has_scope?, #join_id_for, #nested?, #scope_chain, #source_options, #source_reflection, #source_reflection_name, #source_reflection_names, #through_options, #through_reflection, #through_reflection?
#alias_candidate, #build_association, #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, #primary_key_type, #quoted_table_name, #through_reflection?
Constructor Details
#initialize(reflection, previous_reflection) ⇒ PolymorphicReflection
Returns a new instance of PolymorphicReflection.
985
986
987
988
|
# File 'lib/active_record/reflection.rb', line 985
def initialize(reflection, previous_reflection)
@reflection = reflection
@previous_reflection = previous_reflection
end
|
Instance Method Details
#constraints ⇒ Object
1014
1015
1016
|
# File 'lib/active_record/reflection.rb', line 1014
def constraints
@reflection.constraints + [source_type_info]
end
|
#join_keys(association_klass) ⇒ Object
1006
1007
1008
|
# File 'lib/active_record/reflection.rb', line 1006
def join_keys(association_klass)
@reflection.join_keys(association_klass)
end
|
#klass ⇒ Object
990
991
992
|
# File 'lib/active_record/reflection.rb', line 990
def klass
@reflection.klass
end
|
#plural_name ⇒ Object
1002
1003
1004
|
# File 'lib/active_record/reflection.rb', line 1002
def plural_name
@reflection.plural_name
end
|
#scope ⇒ Object
994
995
996
|
# File 'lib/active_record/reflection.rb', line 994
def scope
@reflection.scope
end
|
#source_type_info ⇒ Object
1018
1019
1020
1021
1022
|
# File 'lib/active_record/reflection.rb', line 1018
def source_type_info
type = @previous_reflection.foreign_type
source_type = @previous_reflection.options[:source_type]
lambda { |object| where(type => source_type) }
end
|
#table_name ⇒ Object
998
999
1000
|
# File 'lib/active_record/reflection.rb', line 998
def table_name
@reflection.table_name
end
|
#type ⇒ Object
1010
1011
1012
|
# File 'lib/active_record/reflection.rb', line 1010
def type
@reflection.type
end
|