Redirect to root_url of default_scope when no slug is given
This commit is contained in:
parent
6185e18cc5
commit
f8662c9184
2 changed files with 6 additions and 1 deletions
|
@ -172,10 +172,11 @@ class ApplicationController < ActionController::Base
|
|||
# Set Config and database connection
|
||||
FoodsoftConfig.select_foodcoop params[:foodcoop]
|
||||
rescue => error
|
||||
FoodsoftConfig.select_foodcoop FoodsoftConfig.config[:default_scope]
|
||||
FoodsoftConfig.select_default_foodcoop
|
||||
redirect_to root_url, alert: error.message
|
||||
end
|
||||
else
|
||||
FoodsoftConfig.select_default_foodcoop
|
||||
redirect_to root_url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -80,6 +80,10 @@ class FoodsoftConfig
|
|||
setup_database
|
||||
end
|
||||
|
||||
def select_default_foodcoop
|
||||
select_foodcoop config[:default_scope]
|
||||
end
|
||||
|
||||
def select_multifoodcoop(foodcoop)
|
||||
select_foodcoop foodcoop if config[:multi_coop_install]
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue