Class: ActiveRecord::Reflection::HasOneReflection
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
ActiveRecord::Reflection::AssociationReflection
|
Defined in: | activerecord/lib/active_record/reflection.rb |
Class Method Summary
Instance Attribute Summary
- #has_one? ⇒ Boolean readonly
AssociationReflection
- Inherited
#belongs_to? | Returns |
#collection? | Returns whether or not this association reflection is for a collection association. |
#foreign_type, #has_inverse?, | |
#has_one? | Returns |
#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 |
#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 |
#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 |
#valid_inverse_reflection? | Checks if the inverse reflection that is returned from the |
MacroReflection
- Inherited
#== | Returns |
#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 |
#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
#has_one? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'activerecord/lib/active_record/reflection.rb', line 901
def has_one?; true; end
Instance Method Details
#association_class
[ GitHub ]# File 'activerecord/lib/active_record/reflection.rb', line 903
def association_class if [:through] Associations::HasOneThroughAssociation else Associations::HasOneAssociation end end
#macro
[ GitHub ]# File 'activerecord/lib/active_record/reflection.rb', line 899
def macro; :has_one; end