I need to use function "image_path" in my lib class. I tried this (and couple of other variations):
class CustomHelpers::Base
include ActionView::Helpers::AssetTagHelper
def self.image_url(source)
abs_path = image_path(source)
unless abs_path =~ /^http/
abs_path = "#{request.protocol}#{request.host_with_port}#{abs_path}"
end
abs_path
end
end
But it didn't work. Am I doing it right?
Another question is, how do I find the right class to include? For example if I look at this module: http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html is there a rule of thumb how to include that module in a model / library / class / anything else ?