ActionView::Helpers::AssetUrlHelper
module ActionView::Helpers::AssetUrlHelper
This module provides methods for generating asset paths and urls.
image_path("rails.png") # => "/assets/rails.png" image_url("rails.png") # => "http://www.example.com/assets/rails.png"
Using asset hosts
By default, Rails links to these assets on the current host in the public folder, but you can direct Rails to link to assets from a dedicated asset server by setting ActionController::Base.asset_host
in the application configuration, typically in config/environments/production.rb
. For example, you'd define assets.example.com
to be your asset host this way, inside the configure
block of your environment-specific configuration files or config/app