代码之家  ›  专栏  ›  技术社区  ›  userMod2

使用更改的ID设置根路由

  •  0
  • userMod2  · 技术社区  · 7 年前

    我想要: example.com/123 ,其中123可以是任何字符串。

    我正在使用 get specid .

    get('/:specid' => 'outlets/dance#index', :as => :dance)
    
    1 回复  |  直到 7 年前
        1
  •  0
  •   user3536789    7 年前

    应该指定根目录。您可以重定向到显示页面。例如, root 'employees#show', {id: 1} . 这可能对你有帮助。 root to: 'dashboard#index', to: redirect('/company_structures/3') . 它将像 http://localhost:3000/company_structures/3