Closed kennyadsl closed 1 year ago
Closes #279
Spree::LineItem already has defined in its model accepts_nested_attributes_for :subscription_line_items so we can leverage this to update a nested model of the line item.
Spree::LineItem
accepts_nested_attributes_for :subscription_line_items
The API call should be:
# https://example.com/api/orders/{order_number}/line_items/{line_item_id} { "line_item": { "quantity": 1 } "subscription_line_items_attributes": { "id": {subscription_line_item_id} "interval_length": 15, } }
This "strange" unnested format is required for the way we are updating line items in the API line_item controller: https://github.com/solidusio/solidus/blob/e878076f2ed670d07654ab6293a16588743f2fa6/api/app/controllers/spree/api/line_items_controller.rb#L29.
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed:
Closes #279
Summary
Spree::LineItem
already has defined in its modelaccepts_nested_attributes_for :subscription_line_items
so we can leverage this to update a nested model of the line item.The API call should be:
This "strange" unnested format is required for the way we are updating line items in the API line_item controller: https://github.com/solidusio/solidus/blob/e878076f2ed670d07654ab6293a16588743f2fa6/api/app/controllers/spree/api/line_items_controller.rb#L29.
Checklist
Check out our PR guidelines for more details.
The following are mandatory for all PRs:
The following are not always needed: