Class: Dorsale::CustomerVault::LinksController

Inherits:
ApplicationController show all
Defined in:
app/controllers/dorsale/customer_vault/links_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/dorsale/customer_vault/links_controller.rb', line 10

def create
  authorize @person, :update?

  @link ||= scope.new(link_params_for_create)

  if @link.save
    flash[:notice] = t("messages.links.create_ok")
    redirect_to back_url
  else
    render :new
  end
end

#destroyObject



38
39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/dorsale/customer_vault/links_controller.rb', line 38

def destroy
  authorize @person, :update?

  if @link.destroy
    flash[:notice] = t("messages.links.delete_ok")
  else
    flash[:alert] = t("messages.links.delete_error")
  end

  redirect_to back_url
end

#editObject



23
24
25
# File 'app/controllers/dorsale/customer_vault/links_controller.rb', line 23

def edit
  authorize @person, :update?
end

#newObject



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

def new
  authorize @person, :update?

  @link ||= scope.new
end

#updateObject



27
28
29
30
31
32
33
34
35
36
# File 'app/controllers/dorsale/customer_vault/links_controller.rb', line 27

def update
  authorize @person, :update?

  if @link.update(link_params_for_update)
    flash[:notice] = t("messages.links.update_ok")
    redirect_to back_url
  else
    render :edit
  end
end