Configure dynamic assets_host in Rails 3

前端 未结 4 773
孤街浪徒
孤街浪徒 2021-01-03 07:23

I want Rails 3 to dynamically grab assets depending on current domain:

mysite.com - assets.mysite.com mysite.ru - assets.mysite.ru

Is it possible out of the

4条回答
  •  醉梦人生
    2021-01-03 08:02

    Are you meaning subdomains?

    subdomains(tld_length = 1)
    
    Returns all the subdomains as an array, so ["dev", "www"] would be returned for “dev.www.rubyonrails.org“. You can specify a different tld_length, such as 2 to catch ["www"] instead of ["www", "rubyonrails"] in “www.rubyonrails.co.uk“.
    

提交回复
热议问题