123456789_123456789_123456789_123456789_123456789_

Class: ActiveRecord::Reflection::HasManyReflection

Do not use. This class is for internal use only.

Class Method Summary

Instance Attribute Summary

AssociationReflection - Inherited

#belongs_to?

Returns true if self is a belongs_to reflection.

#collection?

Returns whether or not this association reflection is for a collection association.

#foreign_type, #has_inverse?,
#has_one?

Returns true if self is a has_one reflection.

#has_scope?, #nested?,
#parent_reflection
#polymorphic?, #type,
#validate?

Returns whether or not the association should be validated as part of the parent’s validation.

MacroReflection - Inherited

#active_record, #autosave=,
#name

Returns the name of the macro.

#options

Returns the hash of options used for the macro.

#scope, #plural_name

AbstractReflection - Inherited

#counter_must_be_updated_by_has_many?,
#has_active_cached_counter?

Returns whether this association has a counter cache and its column values were backfilled (and so it is used internally by methods like size/any?/etc).

#has_cached_counter?

Returns whether this association has a counter cache.

#inverse_updates_counter_cache?
#inverse_updates_counter_in_memory?, #strict_loading?, #through_reflection?

Instance Method Summary

AssociationReflection - Inherited

#active_record_primary_key, #add_as_polymorphic_through, #add_as_source, #add_as_through, #association_class, #association_foreign_key, #association_primary_key, #association_scope_cache, #check_eager_loadable!, #check_validity!,
#clear_association_scope_cache

This is for clearing cache on the reflection.

#collect_join_chain

A chain of reflections from this one back to the owner.

#compute_class, #extensions, #foreign_key, #join_foreign_key, #join_id_for, #join_primary_key, #join_primary_type, #join_table,
#macro

Returns the macro type.

#polymorphic_inverse_of, #polymorphic_name, #source_reflection, #through_reflection,
#automatic_inverse_of

returns either nil or the inverse association name that it finds.

#can_find_inverse_of_automatically?

Checks to see if the reflection doesn’t have any options that prevent us from being able to guess the inverse automatically.

#derive_class_name, #derive_fk_query_constraints, #derive_foreign_key, #derive_join_table,
#inverse_name

Attempts to find the inverse association name automatically.

#scope_allows_automatic_inverse_of?

Scopes on the potential inverse reflection prevent automatic inverse_of, since the scope could exclude the owner record we would inverse from.

#valid_inverse_reflection?

Checks if the inverse reflection that is returned from the automatic_inverse_of method is a valid reflection.

MacroReflection - Inherited

#==

Returns true if self and other_aggregation have the same name attribute, active_record attribute, and other_aggregation has an options hash assigned to it.

#compute_class,
#klass

Returns the class for the macro.

#scope_for, #derive_class_name, #normalize_options, #_klass

AbstractReflection - Inherited

#alias_candidate,
#build_association

Returns a new, unsaved instance of the associated class.

#build_scope, #chain, #check_validity_of_inverse!,
#class_name

Returns the class name for the macro.

#constraints, #counter_cache_column, #inverse_of,
#inverse_which_updates_counter_cache

We need to avoid the following situation:

#join_scope, #join_scopes, #klass_join_scope,
#scopes

Returns a list of scopes that should be applied for this ::ActiveRecord::Reflection object when querying the database.

#strict_loading_violation_message, #table_name,
#actual_source_reflection

FIXME: this is a horrible name.

#ensure_option_not_given_as_class!, #primary_key

Constructor Details

This class inherits a constructor from ActiveRecord::Reflection::AssociationReflection

Instance Attribute Details

#collection?Boolean (readonly)

[ GitHub ]

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

def collection?; true; end

Instance Method Details

#association_class

[ GitHub ]

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

def association_class
  if options[:through]
    Associations::HasManyThroughAssociation
  else
    Associations::HasManyAssociation
  end
end

#macro

[ GitHub ]

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

def macro; :has_many; end