santschi
santschi

Reputation: 231

How can I change the default URL of ActiveAdmin?

By default, ActiveAdmin is running under /admin. Is there any way change that?

Upvotes: 17

Views: 9810

Answers (3)

alf
alf

Reputation: 18530

Just for further reference, if you want to run ActiveAdmin from the root path as a standalone app, use this:

config.default_namespace = false

Upvotes: 5

Zequez
Zequez

Reputation: 3499

Alternatively to @Amir answer. If you don't care about the exact path, and just want to change the route to something less obvious without needing to change your routes. On the routes file you can just call ActiveAdmin like:

Rails.application.routes.draw do
  scope 'something-else' do
    ActiveAdmin.routes(self)
    get '/', to: 'admin/dashboard#index'
  end
end

Then your routes would be /something-else/admin and you could access the dashboard on /something-else.

And you could still use the regular helpers like admin_user_path.

Upvotes: 16

Amir
Amir

Reputation: 1872

Yes. You need to add the following line to the config/initializers/active_admin.rb file:

config.default_namespace = :your_desired_namespace

This will create a http://yourdomain.name/your_desired_namespace

Do note, that you will need to update your routes accordingly (i.e admin_user_path will become your_desired_namespace_user_path).

Upvotes: 34

Related Questions