feat: implement resetting a pop
This commit is contained in:
parent
5c721eb08c
commit
9ff401bdfd
2 changed files with 9 additions and 4 deletions
|
@ -24,6 +24,14 @@ class InstanceController < ApplicationController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def reset
|
||||||
|
instance_id, nm = pop_instance_params
|
||||||
|
parent_instance = Instance.find_by(public_id: instance_id)
|
||||||
|
Pop.delete_by(instance_id: parent_instance.id, name: nm)
|
||||||
|
@instance = Instance.includes(:pops).find_by(public_id: instance_id)
|
||||||
|
render partial: "list", locals: { instance: @instance }
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def create_instance_params
|
def create_instance_params
|
||||||
|
|
|
@ -4,10 +4,7 @@ Rails.application.routes.draw do
|
||||||
post "/new", to: "instance#create", as: :new_instance
|
post "/new", to: "instance#create", as: :new_instance
|
||||||
get "/:public_id", to: "instance#show", as: :show_instance
|
get "/:public_id", to: "instance#show", as: :show_instance
|
||||||
post "/pop", to: "instance#pop", as: :pop_in_instance
|
post "/pop", to: "instance#pop", as: :pop_in_instance
|
||||||
|
post "/reset", to: "instance#reset", as: :reset_in_instance
|
||||||
|
|
||||||
get "up" => "rails/health#show", as: :rails_health_check
|
get "up" => "rails/health#show", as: :rails_health_check
|
||||||
|
|
||||||
# Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
|
|
||||||
# get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
|
|
||||||
# get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue