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
load the file located in `config/routes/admin.rb`, and also try to load the
file located in `ee/config/routes/admin.rb`.
It should at least load one file, at most two files. If it cannot find any
files, an error will be raised.
In EE, it should at least load one file, at most two files. If it cannot find
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
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
adding `config/routes/ee_only.rb`.
could still put `draw :ee_only` in both CE and EE, and add
`ee/config/routes/ee_only.rb` in EE, similar to `render_if_exists`.
### Code in `app/controllers/`
......
......@@ -16,8 +16,8 @@ module Gitlab
draw_route(route_path("config/routes/#{routes_name}.rb"))
end
def draw_ee(routes_name)
draw_route(route_path("ee/config/routes/#{routes_name}.rb"))
def draw_ee(_)
true
end
def route_path(routes_name)
......
......@@ -8,3 +8,4 @@ require_relative 'support/rspec'
require 'active_support/all'
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