Sha256: 6fb68c801e6c1fe3d12eb4e3fa7df856edc71b4d8ed6fe2c2b0bd76427e52ec7
Contents?: true
Size: 891 Bytes
Versions: 5
Compression:
Stored size: 891 Bytes
Contents
class Saasaparilla::PlansController < ApplicationController unloadable include Authentication::InstanceMethods before_filter :get_subscription, :only => [:edit, :update] def edit @plans = Plan.all(:order => 'price ASC') end def update if params[:subscription][:plan_id] == "" @subscription.cancel redirect_to(subscription_path, :notice => 'You have been downgraded to the free plan.') return elsif @subscription.downgrade_plan_to(params[:subscription][:plan_id]) redirect_to(subscription_path, :notice => 'Plan was successfully changed.') else render :action => "edit" end end private def get_subscription @subscription = current_billable.subscription if @subscription.nil? flash[:error] = "You do not have a current subscription" redirect_to new_subscription_path end end end
Version data entries
5 entries across 5 versions & 1 rubygems