Sha256: b5ba5b39cd516989841ebbef468e177be00dbca7f3ad7ac378381e0e336e66b5

Contents?: true

Size: 842 Bytes

Versions: 1

Compression:

Stored size: 842 Bytes

Contents

module Gemgento
  class User::RecurringProfilesController < User::BaseController

    def index
      @recurring_profile = RecurringProfile.where(user: current_user)
    end

    def destroy
      recurring_profile = RecurringProfile.find_by!(id: params[:id], user: current_user)

      respond_to do |format|
        result = recurring_profile.change_state('cancel')

        if result == true
          format.json { render json: { status: true } }
          format.html do
            flash[:notice] = 'The recurring profile has been canceled.'
            redirect_to action: 'index'
          end
        else
          format.json { render json: { errors: result }, status: 422 }
          format.html do
            flash[:warning] = result
            redirect_to action: 'index'
          end
        end
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemgento-2.8.0 app/controllers/gemgento/user/recurring_profiles_controller.rb