Sha256: e6be5b93364409261c49a718b4f223344bf1621015375a81c0945755886275d4
Contents?: true
Size: 953 Bytes
Versions: 1
Compression:
Stored size: 953 Bytes
Contents
module Spree class RecurringOrdersController < Spree::StoreController def create original_order = Spree::Order.find(recurring_order_params[:original_order_id]) if original_order.recurring_order.nil? @recurring_order = Spree::RecurringOrder.new @recurring_order.orders << original_order if @recurring_order.save redirect_to(spree.recurring_order_url(@recurring_order.id)) else render :new end else flash[:notice] = "Hmmm... It seems like this order already has a recurring order associated with it. Please get in touch at hello@yourgrocer.com.au if you have any doubts about it" redirect_to(order_url(original_order.number)) end end def show @recurring_order = Spree::RecurringOrder.find(params[:id]) end private def recurring_order_params params[:recurring_order].permit(:original_order_id) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
spree_recurring_order-2.1.3 | app/controllers/spree/recurring_orders_controller.rb |