Class: Dorsale::BillingMachine::PaymentTermsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dorsale/billing_machine/payment_terms_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#scope

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/dorsale/billing_machine/payment_terms_controller.rb', line 16

def create
  @payment_term ||= scope.new(payment_term_params_for_create)

  authorize @payment_term, :create?
  if @payment_term.save

    flash[:notice] = t("payment_terms.create_ok")
    redirect_to back_url
  else
    render action: :new
  end
end

#editObject



29
30
31
# File 'app/controllers/dorsale/billing_machine/payment_terms_controller.rb', line 29

def edit
  authorize @payment_term, :update?
end

#indexObject



4
5
6
7
8
# File 'app/controllers/dorsale/billing_machine/payment_terms_controller.rb', line 4

def index
  authorize model, :list?

  @payment_terms ||= scope.all
end

#newObject



10
11
12
13
14
# File 'app/controllers/dorsale/billing_machine/payment_terms_controller.rb', line 10

def new
  @payment_term ||= scope.new

  authorize @payment_term, :create?
end

#updateObject



33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/dorsale/billing_machine/payment_terms_controller.rb', line 33

def update
  authorize @payment_term, :update?

  if @payment_term.update(payment_term_params_for_update)
    flash[:notice] = t("payment_terms.update_ok")
    redirect_to back_url
  else
    render action: :edit
  end
end