Class: CpOraclecloud::SshKeysController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/cp_oraclecloud/ssh_keys_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'app/controllers/cp_oraclecloud/ssh_keys_controller.rb', line 19

def create
  authorize SshKey
  @ssh_key = SshKey.new(ssh_key_params)

  if @ssh_key.save
    flash[:notice] = "SSH Key has been created."
    redirect_to cp_oraclecloud_ssh_keys_path
  else
    flash.now[:alert] = "SSH Key has not been created."
    render "new"
  end
end

#destroyObject



36
37
38
39
40
41
42
# File 'app/controllers/cp_oraclecloud/ssh_keys_controller.rb', line 36

def destroy
  authorize @ssh_key
  @ssh_key.destroy
  flash[:notice] = "SSH Key has been deleted."

  redirect_to cp_oraclecloud_ssh_keys_path
end

#editObject



32
33
34
# File 'app/controllers/cp_oraclecloud/ssh_keys_controller.rb', line 32

def edit
  authorize @ssh_key
end

#indexObject



5
6
7
8
# File 'app/controllers/cp_oraclecloud/ssh_keys_controller.rb', line 5

def index
  authorize SshKey
  @ssh_keys = policy_scope(SshKey)
end

#newObject



10
11
12
13
# File 'app/controllers/cp_oraclecloud/ssh_keys_controller.rb', line 10

def new
  authorize SshKey
  @ssh_key = CpOraclecloud::SshKey.new
end

#showObject



15
16
17
# File 'app/controllers/cp_oraclecloud/ssh_keys_controller.rb', line 15

def show
  authorize @ssh_key
end

#updateObject



44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/cp_oraclecloud/ssh_keys_controller.rb', line 44

def update
  authorize @ssh_key
  if @ssh_key.update_attributes(ssh_key_params)
    flash[:notice] = "SSH Key has been updated."
    redirect_to cp_oraclecloud_ssh_keys_path
  else
    flash.now[:alert] = "SSH Key has not been updated."
    render "edit"
  end
end