Class: Fixably::CreateHasManyRecord
- Inherits:
-
Object
- Object
- Fixably::CreateHasManyRecord
- Defined in:
- lib/fixably/create_has_many_record.rb
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(record:, collection:) ⇒ CreateHasManyRecord
constructor
A new instance of CreateHasManyRecord.
Constructor Details
#initialize(record:, collection:) ⇒ CreateHasManyRecord
Returns a new instance of CreateHasManyRecord.
12 13 14 15 |
# File 'lib/fixably/create_has_many_record.rb', line 12 def initialize(record:, collection:) @record = record @collection = collection end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
10 11 12 |
# File 'lib/fixably/create_has_many_record.rb', line 10 def collection @collection end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
9 10 11 |
# File 'lib/fixably/create_has_many_record.rb', line 9 def record @record end |
Class Method Details
.call(record:, collection:) ⇒ Object
5 6 7 |
# File 'lib/fixably/create_has_many_record.rb', line 5 def self.call(record:, collection:) new(record: record, collection: collection).call end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 |
# File 'lib/fixably/create_has_many_record.rb', line 17 def call can_append! save_record collection.elements << record end |