Class: Dorsale::BillingMachine::IdCardsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dorsale/billing_machine/id_cards_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/id_cards_controller.rb', line 16

def create
  @id_card ||= scope.new(id_card_params_for_create)

  authorize @id_card, :create?

  if @id_card.save
    flash[:notice] = t("id_cards.create_ok")
    redirect_to back_url
  else
    render action: :new
  end
end

#editObject



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

def edit
  authorize @id_card, :update?
end

#indexObject



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

def index
  authorize model, :list?

  @id_cards ||= scope.all
end

#newObject



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

def new
  @id_card ||= scope.new

  authorize @id_card, :create?
end

#updateObject



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

def update
  authorize @id_card, :update?

  if @id_card.update(id_card_params_for_update)
    flash[:notice] = t("id_cards.update_ok")
    redirect_to back_url
  else
    render action: :edit
  end
end