Class: RedisWebManager::KeysController

Inherits:
ApplicationController show all
Includes:
Pagy::Backend
Defined in:
app/controllers/redis_web_manager/keys_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject

DELETE /key/:key



42
43
44
45
46
47
# File 'app/controllers/redis_web_manager/keys_controller.rb', line 42

def destroy
  key = params[:key].presence
  redirect_to keys_url if key.nil?
  action.del(key)
  redirect_to keys_url
end

#editObject

GET /key/:key



26
27
28
29
30
# File 'app/controllers/redis_web_manager/keys_controller.rb', line 26

def edit
  key = params[:key].presence
  redirect_to keys_url if key.nil?
  @key = format_key(key)
end

#indexObject

GET /keys



12
13
14
15
16
# File 'app/controllers/redis_web_manager/keys_controller.rb', line 12

def index
  @status = info.status
  @url = connection.id
  @pagy, @keys = pagy_array(keys)
end

#showObject

GET /key/:key



19
20
21
22
23
# File 'app/controllers/redis_web_manager/keys_controller.rb', line 19

def show
  key = params[:key].presence
  redirect_to keys_url if key.nil?
  @key = format_key(key)
end

#updateObject

PUT /key/:key



33
34
35
36
37
38
39
# File 'app/controllers/redis_web_manager/keys_controller.rb', line 33

def update
  old_key = params[:old_name].presence
  new_name = params[:new_name].presence
  redirect_to keys_url if old_key.nil? || new_name.nil?
  action.rename(old_key, new_name)
  redirect_to keys_url
end