Class: Wheel::ConfigsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/wheel/configs_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/wheel/configs_controller.rb', line 13

def create
  @config = Config.new(config_params)
  
  if @config.save
    Wheel.reload
    redirect_to configs_path, notice: 'Config was successfully created.'
  else
    render :new
  end
end

#destroyObject



39
40
41
42
43
44
45
# File 'app/controllers/wheel/configs_controller.rb', line 39

def destroy
  @config = Config.find(params[:id])
  @config.destroy
  Wheel.reload
  
  redirect_to configs_path, notice: 'Config was successfully deleted.'
end

#editObject



24
25
26
# File 'app/controllers/wheel/configs_controller.rb', line 24

def edit
  @config = Config.find(params[:id])
end

#indexObject



5
6
7
# File 'app/controllers/wheel/configs_controller.rb', line 5

def index
  @configs = Config.order(:key)
end

#newObject



9
10
11
# File 'app/controllers/wheel/configs_controller.rb', line 9

def new
  @config = Config.new
end

#updateObject



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/wheel/configs_controller.rb', line 28

def update
  @config = Config.find(params[:id])
  
  if @config.update(config_params)
    Wheel.reload
    redirect_to configs_path, notice: 'Config was successfully updated.'
  else
    render :edit
  end
end