Sha256: 8384c6ac970240d282b95ee586f3a4752289925d1d44693930acb29826385863

Contents?: true

Size: 605 Bytes

Versions: 4

Compression:

Stored size: 605 Bytes

Contents

require_dependency "billing/application_controller"

module Billing
  class ChargesController < ApplicationController
    before_action :set_account

    def new
      @charge = @account.charges.new
    end
    
    def create
      @charge = @account.charges.new(charge_params)
      if @charge.save
        redirect_to @account
      else
        render action: :new
      end
    end
    
    private
      def set_account
        @account = billable.billing_accounts.find(params[:account_id])
      end
      
      def charge_params
        params.require(:charge).permit(:price)
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
billing-0.0.4b app/controllers/billing/charges_controller.rb
billing-0.0.4a app/controllers/billing/charges_controller.rb
billing-0.0.4 app/controllers/billing/charges_controller.rb
billing-0.0.3 app/controllers/billing/charges_controller.rb