From ecb2f2a01511fc010c93938ee3b1ac59ea5ef468 Mon Sep 17 00:00:00 2001 From: wvengen Date: Wed, 15 Jan 2014 15:26:33 +0100 Subject: [PATCH 1/2] fix root redirect when using suburi --- app/controllers/home_controller.rb | 5 +++++ config/routes.rb | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 99f108ce..b44f114d 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -62,4 +62,9 @@ class HomeController < ApplicationController redirect_to my_profile_path end + # redirect to root, going to default foodcoop when none given + def redirect_to_foodcoop + redirect_to root_path + end + end diff --git a/config/routes.rb b/config/routes.rb index 3fc54a65..31c2d52f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ Foodsoft::Application.routes.draw do get "sessions/new" - root :to => redirect("/#{FoodsoftConfig.scope}") + root :to => 'home#redirect_to_foodcoop' scope '/:foodcoop' do From 151f851799f15742024c2b03703ca05915cd04dc Mon Sep 17 00:00:00 2001 From: wvengen Date: Wed, 15 Jan 2014 16:24:49 +0100 Subject: [PATCH 2/2] do not require authentication for root redirect --- app/controllers/home_controller.rb | 5 ----- app/controllers/sessions_controller.rb | 7 +++++++ config/routes.rb | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index b44f114d..99f108ce 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -62,9 +62,4 @@ class HomeController < ApplicationController redirect_to my_profile_path end - # redirect to root, going to default foodcoop when none given - def redirect_to_foodcoop - redirect_to root_path - end - end diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 711d67ae..49ecbdb7 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -31,4 +31,11 @@ class SessionsController < ApplicationController session[:return_to] = nil redirect_to login_url, :notice => I18n.t('sessions.logged_out') end + + # redirect to root, going to default foodcoop when none given + # this may not be so much session-related, but it must be somewhere + def redirect_to_foodcoop + redirect_to root_path + end + end diff --git a/config/routes.rb b/config/routes.rb index 31c2d52f..f3acd3b0 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,7 +6,7 @@ Foodsoft::Application.routes.draw do get "sessions/new" - root :to => 'home#redirect_to_foodcoop' + root :to => 'sessions#redirect_to_foodcoop' scope '/:foodcoop' do