Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/64.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/date/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 将管理路由从“admin/”更改为“customadmin/”_Ruby On Rails_Ruby_Nginx_Spree - Fatal编程技术网

Ruby on rails 将管理路由从“admin/”更改为“customadmin/”

Ruby on rails 将管理路由从“admin/”更改为“customadmin/”,ruby-on-rails,ruby,nginx,spree,Ruby On Rails,Ruby,Nginx,Spree,全部。我在谷歌上搜索了很多,但没有找到任何有用的东西 我想将管理路径更改为其他管理路径。在本例中,我们只使用customadmin作为所需的名称 我一直在考虑两种解决方案。一个使用Nginx重写,另一个使用spree应用程序中的路由。也许,我应该两者都用 我是针对SSL层这样做的,因此在我的443服务器部分中,对于Nginx解决方案,我尝试了以下方法: locaton /customadmin/ { rewrite ^/customadmin/(.*)$ /admin/$1 perman

全部。我在谷歌上搜索了很多,但没有找到任何有用的东西

我想将管理路径更改为其他管理路径。在本例中,我们只使用customadmin作为所需的名称

我一直在考虑两种解决方案。一个使用Nginx重写,另一个使用spree应用程序中的路由。也许,我应该两者都用

我是针对SSL层这样做的,因此在我的443服务器部分中,对于Nginx解决方案,我尝试了以下方法:

locaton /customadmin/
{
    rewrite ^/customadmin/(.*)$ /admin/$1 permanent;
}
Spree::Core::Engine.routes.append do
    scope :customadmin do
        namespace :admin do
            resources :my_model
            resources :my_other_model
        end
    end
end
酷。将customadmin映射到所有管理路由。但我不希望任何随机用户访问/admin部分。另外,如果我将“customadmin”映射到“admin”,可能会产生某种错误

想法: *我应该使用“内部”属性吗?也就是说,在admin location块中,仅当请求是内部请求或来自重写时才转到某个位置

*有没有办法在我的spree应用程序中使用namespace/admin来代替“customadmin”?我知道可以通过以下方式实现:

locaton /customadmin/
{
    rewrite ^/customadmin/(.*)$ /admin/$1 permanent;
}
Spree::Core::Engine.routes.append do
    scope :customadmin do
        namespace :admin do
            resources :my_model
            resources :my_other_model
        end
    end
end
环境规格:

狂欢:2.1.2

Ruby:Ruby-2.0.0-p353

铁路:4