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

Use create_if_necessary instead of a simple find_or_initialize #3494

Prev Previous commit
Next Next commit
Only pass the lock option to #find_order_by_token_or_user
Restrict the number of options forwarded to
#find_order_by_token_or_user since the only one it uses is :lock.
  • Loading branch information
elia committed Feb 19, 2020
commit 4bfe9a7658fdc07e793d342032f3204995ea6655
2 changes: 1 addition & 1 deletion core/lib/spree/core/controller_helpers/order.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def current_order(options = {})

return @current_order if @current_order

@current_order = find_order_by_token_or_user(options)
@current_order = find_order_by_token_or_user(lock: options[:lock])

if options[:create_order_if_necessary] && (@current_order.nil? || @current_order.completed?)
@current_order = Spree::Order.new(new_order_params)
Expand Down