小编Mai*_*ner的帖子

子域约束(Rails 3)使本地服务器(瘦)SO SLOW

我最近在我的Rails路由文件中添加了一个子域约束

constraints(:subdomain => 'new') do
  devise_for :customers do 
    get "/customers/sign_up" => "registrations#new"
    post "/customers" => "registrations#create"
    put "/customers/:id" => "registrations#update"
  end
  match '/' => 'roxy#index'
  namespace :roxy, :path => '/' do
    resources :customers
    resources :surveys
  end
end 
Run Code Online (Sandbox Code Playgroud)

为了在本地测试子域路由约束,我将此行添加到我的hosts文件中.

127.0.0.1       new.localhost.local
Run Code Online (Sandbox Code Playgroud)

现在,我在浏览器中在URL new.localhost.local:3000上测试我的应用程序.加载每一页大约需要10到15秒,这非常慢.如果我删除了子域约束并且只是转到127.0.0.1:3000,那么一切都是快速且快速的.

我究竟做错了什么?我是Rails的新手,所以请告诉我是否有更好的方法在rails中进行子域路由,或者是否有需要配置的设置.

subdomain routing localhost thin ruby-on-rails-3

6
推荐指数
1
解决办法
3039
查看次数

标签 统计

localhost ×1

routing ×1

ruby-on-rails-3 ×1

subdomain ×1

thin ×1