Sha256: 1958bfffec7ac13bdcf54d8f0ce5c81c0d1b84a7cb96a04d182e6d85f6e7e8c1

Contents?: true

Size: 657 Bytes

Versions: 4

Compression:

Stored size: 657 Bytes

Contents

require_dependency "billing/application_controller"

module Billing
  class ModifiersController < ApplicationController
    before_action :set_account

    def new
      @modifier = @account.modifiers.new
    end
    
    def create
      @modifier = @account.modifiers.new(modifier_params)
      if @modifier.save
        redirect_to @account
      else
        render action: :new
      end
    end
    
    private
      def set_account
        @account = billable.billing_accounts.find(params[:account_id])
      end
      
      def modifier_params
        params.require(:modifier).permit(:percent_ratio, :fixed_value, :charge_id)
      end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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