简体   繁体   English

Rails 4中主动管理员的自定义路由

[英]Custom route for active admin in rails 4

I'd like to make activeadmin interface to respond at a url like this 我想使activeadmin界面响应这样的网址

http://somesite.com/long_and_strange_string_of_charaters 

Does anybody know how to do it? 有人知道怎么做吗?

I think that a website should give a 404 not found on the admin subpage. 我认为网站应提供在管理子页面上找不到的404。

http://somesite.com/admin  => 404

I think it is a security issue that a hacker gets a form to play with on this url. 我认为黑客在此url上获取可玩的表格是一个安全问题。

With this in the routes.rb 在routes.rb中有了这个

ActiveAdmin.routes(self)

You get the admin interface on the /admin route 您在/ admin路由上获得管理界面

Should have read even more in the documentations. 应该在文档中阅读更多。

in config/initializers/active_admin.rb 在config / initializers / active_admin.rb中

ActiveAdmin.setup do |config|
   config.default_namespace = :long_and_strange_string_of_charaters
end

Hope it will help someone, sometime. 希望它能在某个时候对某人有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM