Class: ModelExplorer::Associations::Base
- Inherits:
-
Object
- Object
- ModelExplorer::Associations::Base
- Extended by:
- Forwardable
- Defined in:
- lib/model_explorer/associations/base.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
readonly
Returns the value of attribute association.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#reflection ⇒ Object
readonly
Returns the value of attribute reflection.
Instance Method Summary collapse
- #export ⇒ Object
-
#initialize(record, reflection, association) ⇒ Base
constructor
A new instance of Base.
- #records ⇒ Object
Constructor Details
#initialize(record, reflection, association) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 |
# File 'lib/model_explorer/associations/base.rb', line 10 def initialize(record, reflection, association) @record = record @reflection = reflection @association = association end |
Instance Attribute Details
#association ⇒ Object (readonly)
Returns the value of attribute association.
8 9 10 |
# File 'lib/model_explorer/associations/base.rb', line 8 def association @association end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
8 9 10 |
# File 'lib/model_explorer/associations/base.rb', line 8 def record @record end |
#reflection ⇒ Object (readonly)
Returns the value of attribute reflection.
8 9 10 |
# File 'lib/model_explorer/associations/base.rb', line 8 def reflection @reflection end |
Instance Method Details
#export ⇒ Object
16 17 18 |
# File 'lib/model_explorer/associations/base.rb', line 16 def export raise NotImplementedError end |
#records ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/model_explorer/associations/base.rb', line 20 def records @_records ||= klass .connection .exec_query(query.to_sql) .map { |record_attributes| build_record(record_attributes) } end |