I'm trying to use Sprockets' image_path method from within a Rails 3 model. I've tried including ActionView::Helpers::AssetTagHelper
in my model and calling image_path but that does not work (undefined local variable or method 'config'
).
Any ideas?
Update - this worked for me:
ActionController::Base.new.view_context.asset_path("image.png")