Class: CircuitSwitch::CircuitSwitchController

Inherits:
ApplicationController show all
Defined in:
app/controllers/circuit_switch/circuit_switch_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



23
24
25
26
27
28
# File 'app/controllers/circuit_switch/circuit_switch_controller.rb', line 23

def destroy
  @circuit_switch = ::CircuitSwitch::CircuitSwitch.find(params[:id])
  @circuit_switch.destroy!
  flash[:success] = "Switch for `#{@circuit_switch.key}` is successfully destroyed."
  redirect_to circuit_switch_index_path
end

#editObject



9
10
11
# File 'app/controllers/circuit_switch/circuit_switch_controller.rb', line 9

def edit
  @circuit_switch = ::CircuitSwitch::CircuitSwitch.find(params[:id])
end

#indexObject



5
6
7
# File 'app/controllers/circuit_switch/circuit_switch_controller.rb', line 5

def index
  @circuit_switches = ::CircuitSwitch::CircuitSwitch.all.order(order_by)
end

#updateObject



13
14
15
16
17
18
19
20
21
# File 'app/controllers/circuit_switch/circuit_switch_controller.rb', line 13

def update
  @circuit_switch = ::CircuitSwitch::CircuitSwitch.find(params[:id])
  if @circuit_switch.update circuit_switch_params
    flash[:success] = "Switch for `#{@circuit_switch.key}` is successfully updated."
    redirect_to circuit_switch_index_path
  else
    render :edit
  end
end