AssetTagHelper::image_path outside views
问题 Supposedly, ActionController::Base.helpers acts like a proxy for accessing helpers outside views. However many of the methods defined there rely on controller variables and I'm unable to succesfully call: ActionController::Base.helpers.image_path("my_image.png") >> TypeError Exception: can't convert nil into String Digging at the source I see compute_asset_host method is trying to access config.asset_host but config is nil . How can I successfully call image_path from outside views? 回答1: Use