module ActionView::Helpers::AssetUrlHelper
def image_path(source, options = {})
The alias +path_to_image+ is provided to avoid that. \Rails uses the alias internally, and
If you have images as application resources this method may conflict with their named routes.
image_path("http://www.example.com/img/edit.png") # => "http://www.example.com/img/edit.png"
image_path("/icons/edit.png") # => "/icons/edit.png"
image_path("icons/edit.png") # => "/assets/icons/edit.png"
image_path("edit.png") # => "/assets/edit.png"
image_path("edit") # => "/assets/edit"
Used internally by +image_tag+ to build the image path:
Full paths from the document root will be passed through.
Computes the path to an image asset.
def image_path(source, options = {}) path_to_asset(source, { type: :image }.merge!(options)) end