How can I get the URL to an asset in the asset pipeline outside of my views?

Hello everyone,

I'm working on a Rails app that uses an external asset host for images and such. I've got my app configured to use the asset host in the environment file. The URL to the asset host is properly rendered when using an image_tag in the view per example (it will correctly set the src to http://asset.host.url/assets/myimage.png instead of /assets/myimage.png).

I'm using paperclip to attach images to my models, and I want to specify a default URL for models that don't have an image. I traced the logic being used by image_tag to ActionView::Helpers::AssetTagHelper::AssetPath#compute_public_path, but I can't seem to figure out how to call this logic from outside of my views.

Can anyone enlighten me as to how to do this correctly?

Regards,
Mark

In the meantime I've figured out a way to get what I want:

ActionController::Base.new.view_context.asset_path "myimage.png"