From f122f942e32ca12482bca32d61e890010c1f2c6e Mon Sep 17 00:00:00 2001 From: James Patrick Date: Sat, 23 May 2020 02:35:34 -0400 Subject: [PATCH] Added routing to join a cluster by the UUID. --- app/controllers/counter_controller.rb | 1 + config/routes.rb | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/controllers/counter_controller.rb b/app/controllers/counter_controller.rb index 21431d6..f00ec59 100644 --- a/app/controllers/counter_controller.rb +++ b/app/controllers/counter_controller.rb @@ -8,6 +8,7 @@ class CounterController < ApplicationController private def associate! + session[:cluster_uuid] = params[:uuid] if params[:uuid] redirect_to cluster_path unless valid_cluster? end end diff --git a/config/routes.rb b/config/routes.rb index b9992fe..192fc33 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -3,6 +3,8 @@ Rails.application.routes.draw do root 'counter#show' - get '/cluster', to: 'cluster#new' + get '/cluster', to: 'cluster#show' post '/cluster', to: 'cluster#create' + + get '/cluster/:uuid', to: 'counter#show' end