diff --git a/app/controllers/hosts_controller.rb b/app/controllers/hosts_controller.rb index 8e92935..383ee4c 100644 --- a/app/controllers/hosts_controller.rb +++ b/app/controllers/hosts_controller.rb @@ -1,43 +1,44 @@ class HostsController < ApplicationController # before_action :fetch_params, only: :create before_action :fetch_host, only: [:show, :edit, :update, :destroy] # GET /hosts def new @host = Host.new end # POST /hosts def create @host = Host.new(fetch_params) if @host.save - redirect_to root_path + redirect_to host_path @host else render :new end end # GET /hosts/1 def show; end # GET /hosts/1/edit def edit; end # PUT /hosts/1 def update;end # DELETE /hosts/1 def destroy - #@host.destroy + @host.destroy + redirect_to root_path end private def fetch_host @host = Host.includes(job_templates: [:fileset, :schedule]).find(params[:id]) end def fetch_params params.require(:host).permit(:fqdn, :port, :password) end end diff --git a/app/views/hosts/show.html.erb b/app/views/hosts/show.html.erb index 9ef66b5..6d6152f 100644 --- a/app/views/hosts/show.html.erb +++ b/app/views/hosts/show.html.erb @@ -1,23 +1,23 @@
<%= notice %>