Class: ActiveRecord::Reflection::RuntimeReflection

Inherits:
PolymorphicReflection show all
Defined in:
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.



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

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

Instance Attribute Details

#nextObject

Returns the value of attribute next.



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

def next
  @next
end

Instance Method Details

#alias_candidate(name) ⇒ Object



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

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

#alias_nameObject



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

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

#all_includesObject



1073
# File 'lib/active_record/reflection.rb', line 1073

def all_includes; yield; end

#constraintsObject



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

def constraints
  @reflection.constraints
end

#klassObject



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

def klass
  @association.klass
end

#source_type_infoObject



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

def source_type_info
  @reflection.source_type_info
end

#table_nameObject



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

def table_name
  klass.table_name
end