【发布时间】:2015-07-15 07:24:47
【问题描述】:
我有问题,我无法解决。
routes.rb 中的这段代码
Rails.application.routes.draw do
namespace :admin do
constraints subdomain: 'admin' do
root to: "home#index"
concern :supportable do
resources :supports, only: [:new, :create]
end
resources :users, concerns: :supportable do
collection do
get 'search'
end
end
end
end
end
我想在 Ruby on Rail 中使用 link_to 进行链接。示例:<%= link_to admin_users_path do %> 但在视图中显示href="/admin/users"。如果我点击链接重定向到http://admin.example.com/admin/users。但是这个链接不正确。我想重定向链接http://admin.example.com/users。
如何使用 link_to 但将 html 呈现为href="/users"。
谢谢,
【问题讨论】:
标签: ruby-on-rails subdomain link-to