Module: SpreeUberDirect::OrderDecorator
- Defined in:
- app/models/spree_uber_direct/order_decorator.rb
Overview
Bridges Spree::Calculator::Shipping::UberDirectQuote#compute_package's
uber_direct_quote_unavailable warning back onto the real order object —
same object-identity bridge and same rationale as spree_doordash's own
Spree::OrderDecorator (see that file's docstring for the full
root-cause story: package.order is a distinct in-memory object from
the order create_proposed_shipments holds, so a direct
package.order.warnings |= [...] silently mutates a throwaway copy).
Deliberately namespaced SpreeUberDirect::OrderDecorator, NOT the bare
Spree::OrderDecorator spree_doordash already defines — both gems
prepend a module onto Spree::Order, and reusing the same module name
would reopen spree_doordash's module and silently overwrite its method
instead of creating a second link in Order's prepend chain. Distinct
module objects chain correctly via super; this is why super is
called here even though it looks like it "does nothing" locally — it's
what lets spree_doordash's own create_proposed_shipments override
still run too, regardless of which gem's initializer loads its
decorator first.
Instance Method Summary collapse
Instance Method Details
#create_proposed_shipments ⇒ Object
21 22 23 24 25 26 |
# File 'app/models/spree_uber_direct/order_decorator.rb', line 21 def create_proposed_shipments Spree::Calculator::Shipping::UberDirectQuote.clear_unavailable(id) result = super merge_uber_direct_quote_warning! result end |