Sha256: 6cd8dae1c11b7d199efed76af311df1cb80150250ce1f100a4d34e5702d50dce

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

module Gemgento
  class Checkout::GiftController < CheckoutController
    skip_before_filter :validate_quote_user

    def update
      respond_to do |format|

        if @quote.update(quote_params)
          format.html { redirect_to after_gift_update_success_path }
          format.json { render json: { quote: @quote } }
        else
          format.html { redirect_to after_gift_update_fail_path, alert: 'There was a problem saving the gift message.' }
          format.json { render json: { errors: @quote.errors.full_messages }, status: 422 }
        end
      end
    end

    private

    def after_gift_update_success_path
      checkout_login_path
    end

    def after_gift_update_fail_path
      cart_path
    end

    def quote_params
      params.require(:quote).permit(:gift_message)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemgento-2.8.0 app/controllers/gemgento/checkout/gift_controller.rb