Commit 2222fb5785f5c0f95153a58bc1f8674751d933b7
Committed by
Diego Camarinha
1 parent
b61b63cc
Revert "[Colab] Optional subdirectory route"
This reverts commit 5a337d1a3abfc8f9d789ec8efd6e41575a416f54. The right way to set the subdirectory is by setting the Rack mount on config.ru or on the webserver like apache or nginx.
Showing
2 changed files
with
4 additions
and
14 deletions
Show diff stats
app/controllers/application_controller.rb
... | ... | @@ -16,25 +16,17 @@ class ApplicationController < ActionController::Base |
16 | 16 | class << self |
17 | 17 | # This is necessary for correct devise routing with locales: https://github.com/plataformatec/devise/wiki/How-To:--Redirect-with-locale-after-authentication-failure |
18 | 18 | def default_url_options |
19 | - default = {} | |
20 | - default.merge!(locale_options) | |
21 | - default.merge!(subdirectory_options) | |
19 | + locale_options | |
22 | 20 | end |
23 | 21 | |
24 | 22 | def locale_options |
25 | 23 | { locale: I18n.locale } |
26 | 24 | end |
27 | - | |
28 | - def subdirectory_options | |
29 | - { subdirectory: 'mezuro' } | |
30 | - end | |
31 | 25 | end |
32 | 26 | |
33 | 27 | # This happens after the *_url *_path helpers |
34 | 28 | def default_url_options |
35 | - default = {} | |
36 | - default.merge!(self.class.locale_options) | |
37 | - default.merge!(self.class.subdirectory_options) | |
29 | + self.class.locale_options | |
38 | 30 | end |
39 | 31 | |
40 | 32 | protected | ... | ... |
config/routes.rb
1 | 1 | Rails.application.routes.draw do |
2 | - scope "/(:subdirectory)", subdirectory: /mezuro/ do | |
2 | + scope "mezuro" do | |
3 | 3 | scope "(:locale)", locale: /en|pt/ do |
4 | 4 | # We need to manually define OmniAuth routes since the automatic generation does not support the dynamic scope |
5 | 5 | devise_for :users, skip: :omniauth_callbacks |
... | ... | @@ -45,10 +45,8 @@ Rails.application.routes.draw do |
45 | 45 | # Tutorials |
46 | 46 | get '/tutorials/:name' => 'tutorials#view', as: 'tutorials' |
47 | 47 | |
48 | - root "home#index", as: 'locale_root' | |
48 | + root "home#index" | |
49 | 49 | end |
50 | - | |
51 | - root "home#index" | |
52 | 50 | end |
53 | 51 | |
54 | 52 | # See comment above for devise_for | ... | ... |