Commit d045df3d authored by Lin Jen-Shin's avatar Lin Jen-Shin

Allow CE do nothing if route doesn't exist

parent 52fa309e
...@@ -338,13 +338,14 @@ When we add `draw :admin` in `config/routes.rb`, the application will try to ...@@ -338,13 +338,14 @@ When we add `draw :admin` in `config/routes.rb`, the application will try to
load the file located in `config/routes/admin.rb`, and also try to load the load the file located in `config/routes/admin.rb`, and also try to load the
file located in `ee/config/routes/admin.rb`. file located in `ee/config/routes/admin.rb`.
It should at least load one file, at most two files. If it cannot find any In EE, it should at least load one file, at most two files. If it cannot find
files, an error will be raised. any files, an error will be raised. In CE, since we don't know if there will
be an EE route, it will not raise any errors even if it cannot find anything.
This means if we want to extend a particular CE route file, just add the same This means if we want to extend a particular CE route file, just add the same
file located in `ee/config/routes`. If we want to add an EE only route, we file located in `ee/config/routes`. If we want to add an EE only route, we
could still use `draw :ee_only` and add `ee/config/routes/ee_only.rb` without could still put `draw :ee_only` in both CE and EE, and add
adding `config/routes/ee_only.rb`. `ee/config/routes/ee_only.rb` in EE, similar to `render_if_exists`.
### Code in `app/controllers/` ### Code in `app/controllers/`
......
...@@ -16,8 +16,8 @@ module Gitlab ...@@ -16,8 +16,8 @@ module Gitlab
draw_route(route_path("config/routes/#{routes_name}.rb")) draw_route(route_path("config/routes/#{routes_name}.rb"))
end end
def draw_ee(routes_name) def draw_ee(_)
draw_route(route_path("ee/config/routes/#{routes_name}.rb")) true
end end
def route_path(routes_name) def route_path(routes_name)
......
...@@ -8,3 +8,4 @@ require_relative 'support/rspec' ...@@ -8,3 +8,4 @@ require_relative 'support/rspec'
require 'active_support/all' require 'active_support/all'
ActiveSupport::Dependencies.autoload_paths << 'lib' ActiveSupport::Dependencies.autoload_paths << 'lib'
ActiveSupport::Dependencies.autoload_paths << 'ee/lib'
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment