2011-08-20 33 views

回答

0

使用資產標籤幫手,image_tag等:
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html

無論您的電流路徑應該沒有什麼區別,因爲訪問的資產應該從根本進行,例如/images/whatever.jpg,/stylesheets/whatever.css

資產標籤幫助程序將使這個透明,此外,如果您曾經使用除您的Web服務器以外的資產主機,它們將爲您轉換路徑。例如。

# if you define a different asset_host, Rails will handle it. 
ActionController::Base.asset_host = "assets.example.com" 

image_tag("rails.png") 
# => <img alt="Rails" src="http://assets.example.com/images/rails.png?1230601161" />