通过辅助方法覆盖 Rails 中的资产主机?
我想知道是否有办法覆盖图像的资产主机。
例如,假设我有以下资产主机和图像标签,
config.asset_host = "www.xxx.com
image_tag "blerg.gif"
这将输出带有 scr 的图像标签:
www.xxx.com/blerg.gif
是否有一种方法可以内联更改资产主机,例如:
image_tag "blerg.gif", :host => 'www.yyy.com
这将更改图像的资产主机。
干杯。
I was wondering if there was a way to override the asset host of an image.
For example lets say I have the following asset host and image tag
config.asset_host = "www.xxx.com
image_tag "blerg.gif"
This would out put and image tag with the scr:
www.xxx.com/blerg.gif
Is there a way to change the asset host inline for example:
image_tag "blerg.gif", :host => 'www.yyy.com
Which would change the asset host of the image.
Cheers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以传递完整网址:
image_tag "http://www.yyy.com/blerg.gif"
You can pass your full url:
image_tag "http://www.yyy.com/blerg.gif"