Class: ActiveRecord::Associations::Builder::BelongsTo
Overview
Instance Attribute Summary
Attributes inherited from Association
#name, #options, #scope
Class Method Summary
collapse
Instance Method Summary
collapse
define_constructors, define_validations
Methods inherited from Association
build, #build, create_builder, #define_extensions, define_readers, define_validations, define_writers, #initialize, #validate_options
Class Method Details
.define_accessors(mixin, reflection) ⇒ Object
21
22
23
24
|
# File 'lib/active_record/associations/builder/belongs_to.rb', line 21
def self.define_accessors(mixin, reflection)
super
add_counter_cache_methods mixin
end
|
.define_callbacks(model, reflection) ⇒ Object
15
16
17
18
19
|
# File 'lib/active_record/associations/builder/belongs_to.rb', line 15
def self.define_callbacks(model, reflection)
super
add_counter_cache_callbacks(model, reflection) if reflection.options[:counter_cache]
add_touch_callbacks(model, reflection) if reflection.options[:touch]
end
|
.valid_dependent_options ⇒ Object
11
12
13
|
# File 'lib/active_record/associations/builder/belongs_to.rb', line 11
def self.valid_dependent_options
[:destroy, :delete]
end
|
Instance Method Details
#macro ⇒ Object
3
4
5
|
# File 'lib/active_record/associations/builder/belongs_to.rb', line 3
def macro
:belongs_to
end
|
#valid_options ⇒ Object
7
8
9
|
# File 'lib/active_record/associations/builder/belongs_to.rb', line 7
def valid_options
super + [:foreign_type, :polymorphic, :touch, :counter_cache]
end
|