2

我想在 .sass.erb 文件中获取当前子域。

我尝试如下 - $get_subdomain: <%= request.subdomain %>

但得到错误 - 未定义的方法或变量请求。

我也尝试在 lib 中添加自定义函数,但仍然遇到相同的错误。如何在 sass 文件中获取当前子域?有人能帮我吗。

4

1 回答 1

0

SASS is compiled to CSS outside of the application context, so there is no request.

What's your problem around this? Why do you need the subdomain in SASS?

You may also have a look at asset_url/_host configuration for SASS and/or Rails.

于 2012-11-08T12:06:40.003 回答