Class: MissionControl::Servers::ServiceSettingsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/mission_control/servers/service_settings_controller.rb

Instance Method Summary collapse

Instance Method Details

#editObject



3
4
5
6
7
8
9
# File 'app/controllers/mission_control/servers/service_settings_controller.rb', line 3

def edit
  @project = Project.find(params[:project_id])
  @service_setting = @project.service_settings.find_or_initialize_by(hostname: params[:id])
  @service_setting.label = params[:id] if @service_setting.new_record?
  @service_setting.save # To limit having to have a create action
  @requests = @project.requests.select(:hostname).distinct.pluck(:hostname)
end

#updateObject



11
12
13
14
15
16
# File 'app/controllers/mission_control/servers/service_settings_controller.rb', line 11

def update
  @project = Project.find(params[:project_id])
  @service_setting = @project.service_settings.find_by(hostname)
  @service_setting.update(label)
  redirect_to projects_path, notice: "Updated Service Settings."
end