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
|
# Set Config and database connection
|
||||||
FoodsoftConfig.select_foodcoop params[:foodcoop]
|
FoodsoftConfig.select_foodcoop params[:foodcoop]
|
||||||
rescue => error
|
rescue => error
|
||||||
FoodsoftConfig.select_foodcoop FoodsoftConfig.config[:default_scope]
|
FoodsoftConfig.select_default_foodcoop
|
||||||
redirect_to root_url, alert: error.message
|
redirect_to root_url, alert: error.message
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
FoodsoftConfig.select_default_foodcoop
|
||||||
redirect_to root_url
|
redirect_to root_url
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -80,6 +80,10 @@ class FoodsoftConfig
|
||||||
setup_database
|
setup_database
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def select_default_foodcoop
|
||||||
|
select_foodcoop config[:default_scope]
|
||||||
|
end
|
||||||
|
|
||||||
def select_multifoodcoop(foodcoop)
|
def select_multifoodcoop(foodcoop)
|
||||||
select_foodcoop foodcoop if config[:multi_coop_install]
|
select_foodcoop foodcoop if config[:multi_coop_install]
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue