Class: ActiveRecord::Associations::Builder::BelongsTo
- Inherits:
-
SingularAssociation
- Object
- Association
- SingularAssociation
- ActiveRecord::Associations::Builder::BelongsTo
- Defined in:
- activerecord/lib/active_record/associations/builder/belongs_to.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from Association
#model, #name, #options, #scope
Instance Method Summary collapse
- #build ⇒ Object
- #constructable? ⇒ Boolean
- #macro ⇒ Object
- #valid_dependent_options ⇒ Object
- #valid_options ⇒ Object
Methods inherited from SingularAssociation
#define_accessors, #define_constructors
Methods inherited from Association
build, #configure_dependency, #define_accessors, #define_readers, #define_writers, #initialize, #mixin, #validate_options
Constructor Details
This class inherits a constructor from ActiveRecord::Associations::Builder::Association
Instance Method Details
#build ⇒ Object
15 16 17 18 19 20 |
# File 'activerecord/lib/active_record/associations/builder/belongs_to.rb', line 15 def build reflection = super add_counter_cache_callbacks(reflection) if [:counter_cache] add_touch_callbacks(reflection) if [:touch] reflection end |
#constructable? ⇒ Boolean
11 12 13 |
# File 'activerecord/lib/active_record/associations/builder/belongs_to.rb', line 11 def constructable? ![:polymorphic] end |
#macro ⇒ Object
3 4 5 |
# File 'activerecord/lib/active_record/associations/builder/belongs_to.rb', line 3 def macro :belongs_to end |
#valid_dependent_options ⇒ Object
22 23 24 |
# File 'activerecord/lib/active_record/associations/builder/belongs_to.rb', line 22 def [:destroy, :delete] end |
#valid_options ⇒ Object
7 8 9 |
# File 'activerecord/lib/active_record/associations/builder/belongs_to.rb', line 7 def super + [:foreign_type, :polymorphic, :touch] end |