Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delegation error for serializer #158

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/models/spree/order_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def self.prepended(base)
class_name: 'Spree::BookkeepingDocument',
as: :printable

base.delegate :number, :date, to: :invoice, prefix: true
base.delegate :number, :date, to: :invoice, prefix: true, allow_nil: true

# Create a new invoice before transitioning to complete
#
Expand Down Expand Up @@ -47,4 +47,4 @@ def invoice_for_order
end
end
end
::Spree::Order.prepend Spree::OrderDecorator
::Spree::Order.prepend Spree::OrderDecorator
4 changes: 2 additions & 2 deletions app/models/spree/printables/order/invoice_view.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ def items
end

def firstname
printable.tax_address.firstname
(printable.tax_address || printable.bill_address).firstname
end

def lastname
printable.tax_address.lastname
(printable.tax_address || printable.bill_address).lastname
end

private
Expand Down