Skip to content

Commit

Permalink
Refactor Spree::Order - using -> notation for lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
Trung Lê committed Apr 2, 2013
1 parent 6465730 commit 556cf76
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/app/models/spree/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ class Order < ActiveRecord::Base
checkout_flow do
go_to_state :address
go_to_state :delivery
go_to_state :payment, if: lambda { |order|
go_to_state :payment, if: ->(order) do
# Fix for #2191
if order.shipments
order.update_totals
end
order.payment_required?
end
go_to_state :confirm, if: ->(order) { order.confirmation_required? }
go_to_state :complete, if: ->(order) {
(order.payment_required? && order.has_unprocessed_payments?) || !order.payment_required?
}
go_to_state :confirm, if: lambda { |order| order.confirmation_required? }
go_to_state :complete, if: lambda { |order| (order.payment_required? && order.has_unprocessed_payments?) || !order.payment_required? }
remove_transition from: :delivery, to: :confirm
end

Expand Down

0 comments on commit 556cf76

Please sign in to comment.