Reputation: 615
I'm just starting out with Rails and I decided to try out ActiveAdmin last night. I was able to register a new resource name 'Pages' in my ActiveAdmin app, but there's one thing I can't figure out how to customize with it.
I create a new Page with ActiveAdmin, but it's published within the admin/.. path. (e.g. mydomain/admin/page/1)
How do I change the routing so the page can be viewed at mydomain/page/1? Are you able to change the routing of existing resources in ActiveAdmin?
I'm very new at Rails so I assume this is a pretty easy fix. I plan to run through some more tutorials/books so I can better understand routing.
Upvotes: 3
Views: 1315
Reputation: 52357
You can change the default admin
namespace.
To do so you have to go to config/initializers/active_admin.rb
file and find the following configuration:
# Default:
# config.default_namespace = :admin
Uncomment the line and set the default_namespace
to whatever you need.
However, if you need to turn off the namespace at all, you will have to set the default_namespace
to false
:
config.default_namespace = false
This will allow you to run the AA from the root.
By doing so be aware of changes in routes:
if changed the namespace to hello
, the admin_games_path
becomes hello_games_path
;
if changed to no namespace, use normal routes: admin_games_path
becomes games_path
.
Upvotes: 3