Skip to content

Instantly share code, notes, and snippets.

@fphilipe
Created Sep 21, 2011
Embed
What would you like to do?
Easier access to assets in Rails 3.1
# coding: UTF-8
# A module to facilitate the retrieval of asset paths and urls in Rails 3.1.
module Assets
extend self
def url(file)
host + path(file)
end
def path(file)
Rails.application.assets.path(file, true, prefix)
end
def prefix
Rails.configuration.assets.prefix
end
def host
Rails.configuration.action_controller.asset_host
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment