Ruby on rails 如何将url路由设置为其他子域
我可以使用哪种路由路径从非子域页面链接到子域页面 我已经通过以下方式向我的站点添加了子域 我对我的站点所做的主要更改是将每个博客作者与一个唯一的子域相匹配 routes.rbRuby on rails 如何将url路由设置为其他子域,ruby-on-rails,routing,subdomain,Ruby On Rails,Routing,Subdomain,我可以使用哪种路由路径从非子域页面链接到子域页面 我已经通过以下方式向我的站点添加了子域 我对我的站点所做的主要更改是将每个博客作者与一个唯一的子域相匹配 routes.rb match '', to: 'blogs#show', constraints: {subdomain: /.+/} def show @blog = Blog.find_by_subdomain!(request.subdomain) end <%= link_to blog.name, root_url(su
match '', to: 'blogs#show', constraints: {subdomain: /.+/}
def show
@blog = Blog.find_by_subdomain!(request.subdomain)
end
<%= link_to blog.name, root_url(subdomain: blog.subdomain) %>
blogs\u controller.rb
match '', to: 'blogs#show', constraints: {subdomain: /.+/}
def show
@blog = Blog.find_by_subdomain!(request.subdomain)
end
<%= link_to blog.name, root_url(subdomain: blog.subdomain) %>
blogs/index.html.erb
match '', to: 'blogs#show', constraints: {subdomain: /.+/}
def show
@blog = Blog.find_by_subdomain!(request.subdomain)
end
<%= link_to blog.name, root_url(subdomain: blog.subdomain) %>
从忍者子域页面(这是我想要的),但是
从主页没有子域(不是我想要的)
有没有一种方法可以通过类似于,
article(subdomain:article.blog.subdomain)
的方式强制指向特定子域的路径?我希望每一篇文章的链接都能转到一个子域名页面 为了使文章的所有链接都具有作者博客的子域,我使用了
article\uURL(article,子域:article.blog.subdomain)
作为我的道路