Class: Saasaparilla::Admin::SubscriptionsController

Inherits:
ApplicationController
  • Object
show all
Includes:
Authentication::InstanceMethods, Authorization::InstanceMethods
Defined in:
app/controllers/saasaparilla/admin/subscriptions_controller.rb

Instance Method Summary collapse

Methods included from Authorization::InstanceMethods

included

Methods included from Authentication::InstanceMethods

included, #require_current_billable

Instance Method Details

#cancelObject



27
28
29
30
31
32
# File 'app/controllers/saasaparilla/admin/subscriptions_controller.rb', line 27

def cancel
  @subscription = Subscription.find(params[:id])
  @subscription.cancel
  redirect_to admin_subscription_path(@subscription)
  flash[:notice] = "Subscription was canceled."
end

#indexObject

GET /admin/subscriptions



8
9
10
# File 'app/controllers/saasaparilla/admin/subscriptions_controller.rb', line 8

def index
  @subscriptions = Subscription.paginate(:page => params[:page], :per_page => 20, :order => "created_at DESC")
end

#showObject



12
13
14
# File 'app/controllers/saasaparilla/admin/subscriptions_controller.rb', line 12

def show
  @subscription = Subscription.find(params[:id])
end

#toggle_no_chargeObject



16
17
18
19
20
21
22
23
24
25
# File 'app/controllers/saasaparilla/admin/subscriptions_controller.rb', line 16

def toggle_no_charge
  @subscription = Subscription.find(params[:id])
  @subscription.toggle!(:no_charge)
  redirect_to admin_subscription_path(@subscription)
  if @subscription.no_charge
    flash[:notice] = "Subscription will not be charged."
  else
    flash[:notice] = "Subscription will now be charged."
  end
end