I am trying to get the link to go to
admin.mysite.com/articles/new
and currently am using
link_to 'new article', [root_url(subdomain: 'admin), 'articles/new'].join
but am sure there's a better (rails) way to do it. Any ideas?
You can use the URL helper with subdomain as below:
link_to 'new article', new_article_url(subdomain: 'admin')
Assuming new_article_url
will points to articles/new
.
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.