Skip to content

Commit

Permalink
Use create_if_necessary instead of a simpler creation
Browse files Browse the repository at this point in the history
Using current_order with create_if_necessary creates order that are
much more complete adding info about the ip, creator and other meta
data that is better to have rather than not. Not to mention that it's
also more readable.
  • Loading branch information
elia committed Jan 29, 2020
1 parent c9a2b9e commit a5839ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion frontend/app/controllers/spree/orders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def update

# Shows the current incomplete order from the session
def edit
@order = current_order || Spree::Order.incomplete.find_or_initialize_by(guest_token: cookies.signed[:guest_token])
@order = current_order(create_order_if_necessary: true)
authorize! :read, @order, cookies.signed[:guest_token]
associate_user
if params[:id] && @order.number != params[:id]
Expand Down

0 comments on commit a5839ad

Please sign in to comment.