8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
# File 'app/controllers/spree/repeated_orders_controller.rb', line 8
def create
past_order = Spree::Order.find_by(number: params[:number])
new_order = current_order(create_order_if_necessary: true)
duplicate_order(past_order, new_order)
if new_order.save
flash[:success] = 'We have added your past order items to the cart. Just proceed to checkout to complete it.'
else
flash[:error] = 'We are sorry, but we could not add your past items to the cart.'
end
redirect_to(cart_path)
end
|