Sha256: c4017d05afa35e8fbb8fd1f36395bac90e5659387397c82ec6cb547dc40f525a

Contents?: true

Size: 637 Bytes

Versions: 4

Compression:

Stored size: 637 Bytes

Contents

require_dependency "billing/application_controller"

module Billing
  class PaymentsController < ApplicationController
    before_action :set_account

    def new
      @payment = @account.payments.new(value: @account.total)
    end
    
    def create
      @payment = @account.payments.new(payment_params)
      if @payment.save
        redirect_to @account
      else
        render action: :new
      end
    end
    
    private
      def set_account
        @account = billable.billing_accounts.find(params[:account_id])
      end
      
      def payment_params
        params.require(:payment).permit(:value)
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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