I want to do some Facebook posting from an observer class, however, I want to reference an image from my server. In the past I have had some pretty hackie methods of doing this, but now with the new assets stuff, I though I could use image_path or image_url methods.
However, I can't seem to figure out how to call these. They are not class level methods of ActionView::Helpers::AssetTagHelper so doing
ActionView::Helpers::AssetTagHelper.image_url
Doesn't work.
First of all, I don't think image_url
exists. I only see image_path
in the API.
To be able to use that method, you have to include the AssetTagHelper module:
include ActionView::Helpers::AssetTagHelper
image_path('my_image.png')
In Rails 4 include AssetUrlHelper:
include ActionView::Helpers::AssetUrlHelper
image_path('my_image.png')