Class: ActiveRecord::Reflection::RuntimeReflection

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

Overview

:nodoc:

Instance Attribute Summary collapse

Attributes inherited from ThroughReflection

#delegate_reflection

Instance Method Summary collapse

Methods inherited from PolymorphicReflection

#join_keys, #plural_name, #scope, #type

Methods inherited from ThroughReflection

#add_as_polymorphic_through, #add_as_source, #add_as_through, #association_primary_key, #association_primary_key_type, #check_validity!, #clear_association_scope_cache, #collect_join_chain, #collect_join_reflections, #has_scope?, #join_id_for, #join_keys, #nested?, #scope_chain, #source_options, #source_reflection, #source_reflection_name, #source_reflection_names, #through_options, #through_reflection, #through_reflection?

Methods inherited from AbstractReflection

#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, #join_keys, #primary_key_type, #quoted_table_name, #through_reflection?

Constructor Details

#initialize(reflection, association) ⇒ RuntimeReflection

Returns a new instance of RuntimeReflection.


1040
1041
1042
1043
# File 'activerecord/lib/active_record/reflection.rb', line 1040

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

Instance Attribute Details

#nextObject

Returns the value of attribute next


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

def next
  @next
end

Instance Method Details

#alias_candidate(name) ⇒ Object


1061
1062
1063
# File 'activerecord/lib/active_record/reflection.rb', line 1061

def alias_candidate(name)
  "#{plural_name}_#{name}_join"
end

#alias_nameObject


1065
1066
1067
# File 'activerecord/lib/active_record/reflection.rb', line 1065

def alias_name
  Arel::Table.new(table_name)
end

#all_includesObject


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

def all_includes; yield; end

#constraintsObject


1053
1054
1055
# File 'activerecord/lib/active_record/reflection.rb', line 1053

def constraints
  @reflection.constraints
end

#klassObject


1045
1046
1047
# File 'activerecord/lib/active_record/reflection.rb', line 1045

def klass
  @association.klass
end

#source_type_infoObject


1057
1058
1059
# File 'activerecord/lib/active_record/reflection.rb', line 1057

def source_type_info
  @reflection.source_type_info
end

#table_nameObject


1049
1050
1051
# File 'activerecord/lib/active_record/reflection.rb', line 1049

def table_name
  klass.table_name
end