Class: Saasaparilla::CreditCardController

Inherits:
ApplicationController show all
Includes:
Authentication::InstanceMethods
Defined in:
app/controllers/saasaparilla/credit_card_controller.rb

Instance Method Summary collapse

Methods included from Authentication::InstanceMethods

included, #require_current_billable

Instance Method Details

#editObject



9
10
11
# File 'app/controllers/saasaparilla/credit_card_controller.rb', line 9

def edit

end

#updateObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/controllers/saasaparilla/credit_card_controller.rb', line 13

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