8000 Add documentation for namespace route_options usage (#5932) · stephancom/activeadmin@ef0837b · GitHub
[go: up one dir, main page]

Skip to content

Commit ef0837b

Browse files
westongangerjavierjulio
authored andcommitted
Add documentation for namespace route_options usage (activeadmin#5932)
1 parent 85eb7ca commit ef0837b

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/1-general-configuration.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,26 @@ ActiveAdmin.setup do |config|
106106
end
107107
```
108108

109+
If you are creating a multi-tenant application you may want to have multiple namespaces mounted to the same path. We can do this using the `route_options` settings on the namespace
110+
111+
```ruby
112+
config.namespace :site_1 do |admin|
113+
admin.route_options = { path: :admin, constraints: ->(request){ request.domain == "site1.com" } }
114+
end
115+
116+
config.namespace :site_2 do |admin|
117+
admin.route_options = { path: :admin, constraints: ->(request){ request.domain == "site2.com" } }
118+
end
119+
```
120+
121+
If you would like to mount the namespace to a subdomain instead of path we can use the `route_options` for this as well
122+
123+
```ruby
124+
config.namespace :admin do |admin|
125+
admin.route_options = { path: '', subdomain: 'admin' }
126+
end
127+
```
128+
109129
Each setting available in the Active Admin setup block is configurable on a per
110130
namespace basis.
111131

0 commit comments

Comments
 (0)
0