Class: ActiveRecord::Associations::Builder::CollectionAssociation
- Inherits:
-
Association
- Object
- Association
- ActiveRecord::Associations::Builder::CollectionAssociation
- Defined in:
- activerecord/lib/active_record/associations/builder/collection_association.rb
Overview
:nodoc:
Direct Known Subclasses
Constant Summary collapse
- CALLBACKS =
[:before_add, :after_add, :before_remove, :after_remove]
Instance Attribute Summary collapse
-
#block_extension ⇒ Object
readonly
Returns the value of attribute block_extension.
Attributes inherited from Association
#model, #name, #options, #reflection
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(model, name, options, &extension) ⇒ CollectionAssociation
constructor
A new instance of CollectionAssociation.
- #writable? ⇒ Boolean
Methods inherited from Association
Constructor Details
#initialize(model, name, options, &extension) ⇒ CollectionAssociation
Returns a new instance of CollectionAssociation.
16 17 18 19 |
# File 'activerecord/lib/active_record/associations/builder/collection_association.rb', line 16 def initialize(model, name, , &extension) super(model, name, ) @block_extension = extension end |
Instance Attribute Details
#block_extension ⇒ Object (readonly)
Returns the value of attribute block_extension
10 11 12 |
# File 'activerecord/lib/active_record/associations/builder/collection_association.rb', line 10 def block_extension @block_extension end |
Class Method Details
.build(model, name, options, &extension) ⇒ Object
12 13 14 |
# File 'activerecord/lib/active_record/associations/builder/collection_association.rb', line 12 def self.build(model, name, , &extension) new(model, name, , &extension).build end |
Instance Method Details
#build ⇒ Object
21 22 23 24 25 26 |
# File 'activerecord/lib/active_record/associations/builder/collection_association.rb', line 21 def build wrap_block_extension reflection = super CALLBACKS.each { |callback_name| define_callback(callback_name) } reflection end |
#writable? ⇒ Boolean
28 29 30 |
# File 'activerecord/lib/active_record/associations/builder/collection_association.rb', line 28 def writable? true end |