Sha256: ac34711071c10dc8add06e0b488e8173698b25f1230775ca8cb49f35937893df

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

class Saasaparilla::CreditCardController < ApplicationController
  unloadable
  include Authentication::InstanceMethods
  ssl_required :edit, :update 
  before_filter :set_subscription
  before_filter :set_credit_cards
  
  
  def edit

  end
  
  def update
    begin 
      if @subscription.credit_card.update_attributes(params[:credit_card])
        flash[:notice] = "Your credit card was successfully updated."
        redirect_to subscription_path
      else
        # @credit_card = @credit_card.reload_with_errors
        render :action => "edit"
        flash[:error] = "Your credit card could not be updated due to errors. Please review the form and correct them."
      end
     rescue Exception => e
          flash[:error] = e.message
          render :action => "edit"
          flash.discard
      end
  end
 
  private 
   
  def set_subscription
    @subscription = current_billable.subscription
  end
  
  def set_credit_cards
    @credit_card = @subscription.credit_card
    @current_card = @credit_card.clone
  end
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
saasaparilla-0.2.2 app/controllers/saasaparilla/credit_card_controller.rb
saasaparilla-0.2.1 app/controllers/saasaparilla/credit_card_controller.rb
saasaparilla-0.1.8 app/controllers/saasaparilla/credit_card_controller.rb
saasaparilla-0.1.7 app/controllers/saasaparilla/credit_card_controller.rb
saasaparilla-0.1.6 app/controllers/saasaparilla/credit_card_controller.rb