Rails-如何获取控制器中单个图像资产的URL?

| 我尝试过包括
ActionView::Helpers::AssetTagHelper
,然后使用
image_path()
方法,但是这让我感到悲伤:
undefined local variable or method `config\' for ActionView::Helpers::AssetTagHelper:Module
我可能缺少一些简单的东西。有任何想法吗?     
已邀请:
我在以下Barlow的答案中找到了解决方案:如何在Rails 3 Controller中使用image_path
view_context.image_path(\'/path/to/image\')
似乎对我有用,无需在Controller中包含帮助者     

要回复问题请先登录注册