Class: ActiveRecord::Associations::Builder::Association
- Inherits:
-
Object
- Object
- ActiveRecord::Associations::Builder::Association
- Defined in:
- activerecord/lib/active_record/associations/builder/association.rb
Overview
:nodoc:
Instance Attribute Summary (collapse)
-
- (Object) model
readonly
Returns the value of attribute model.
-
- (Object) name
readonly
Returns the value of attribute name.
-
- (Object) options
readonly
Returns the value of attribute options.
-
- (Object) reflection
readonly
Returns the value of attribute reflection.
Class Method Summary (collapse)
Instance Method Summary (collapse)
- - (Object) build
-
- (Association) initialize(model, name, options)
constructor
A new instance of Association.
Constructor Details
- (Association) initialize(model, name, options)
A new instance of Association
15 16 17 |
# File 'activerecord/lib/active_record/associations/builder/association.rb', line 15 def initialize(model, name, ) @model, @name, @options = model, name, end |
Instance Attribute Details
- (Object) model (readonly)
Returns the value of attribute model
9 10 11 |
# File 'activerecord/lib/active_record/associations/builder/association.rb', line 9 def model @model end |
- (Object) name (readonly)
Returns the value of attribute name
9 10 11 |
# File 'activerecord/lib/active_record/associations/builder/association.rb', line 9 def name @name end |
- (Object) options (readonly)
Returns the value of attribute options
9 10 11 |
# File 'activerecord/lib/active_record/associations/builder/association.rb', line 9 def @options end |
- (Object) reflection (readonly)
Returns the value of attribute reflection
9 10 11 |
# File 'activerecord/lib/active_record/associations/builder/association.rb', line 9 def reflection @reflection end |
Class Method Details
+ (Object) build(model, name, options)
11 12 13 |
# File 'activerecord/lib/active_record/associations/builder/association.rb', line 11 def self.build(model, name, ) new(model, name, ).build end |
Instance Method Details
- (Object) build
19 20 21 22 23 24 |
# File 'activerecord/lib/active_record/associations/builder/association.rb', line 19 def build reflection = model.create_reflection(self.class.macro, name, , model) define_accessors reflection end |