I would like disable subdomain on link_to but it's not working.
Her's my route.rb :
Rails.application.routes.draw do
constraints subdomain: false do
root to: 'welcome#index'
# USERS
devise_for :users
resource :user, only: [:edit] do
collection do
patch 'update_password'
end
end
resource :users do
collection do
match 'show/:id' => 'users#show', :as => :user_show, via: 'get'
match '' => 'users#index', :as => :user_index, via: 'get'
end
end
end
constraints subdomain: /.+/ do namespace :manager do scope shallow_prefix: "sekret" do resources :articles root 'manager#index' end end end
end
When i'm on "test.local.dev/manager" and create a link_to :
=link_to article.user.username, user_show_users_path(article.user)
But normally this returning "local.dev/users/show/:id but this is returning "test.local.dev/users/show/:id"
I would like remove the subdomain "test".
When can i make that ?
使用此代码:
<%= link_to article.user.username, user_show_users_url(article.user,:subdomain=>false)%>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.