Class: MissionControl::Web::RoutesController

Inherits:
ApplicationController show all
Includes:
ApplicationScoped
Defined in:
app/controllers/mission_control/web/routes_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
25
26
27
28
# File 'app/controllers/mission_control/web/routes_controller.rb', line 20

def create
  @route = MissionControl::Web::Route.new(application_id: @application.id, **route_params)

  if @route.save
    redirect_to [ @application, @route ], notice: "Route was successfully created."
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



38
39
40
41
42
# File 'app/controllers/mission_control/web/routes_controller.rb', line 38

def destroy
  @route.destroy

  redirect_to application_routes_url(@route.application), notice: "Route was successfully destroyed."
end

#editObject



17
18
# File 'app/controllers/mission_control/web/routes_controller.rb', line 17

def edit
end

#indexObject



6
7
8
# File 'app/controllers/mission_control/web/routes_controller.rb', line 6

def index
  @routes = @application.routes
end

#newObject



13
14
15
# File 'app/controllers/mission_control/web/routes_controller.rb', line 13

def new
  @route = MissionControl::Web::Route.new(application_id: @application.id)
end

#showObject



10
11
# File 'app/controllers/mission_control/web/routes_controller.rb', line 10

def show
end

#updateObject



30
31
32
33
34
35
36
# File 'app/controllers/mission_control/web/routes_controller.rb', line 30

def update
  if @route.update(route_params)
    redirect_to [ @route.application, @route ], notice: "Route was successfully updated."
  else
    render :edit, status: :unprocessable_entity
  end
end