0
我的圖像位於/app/assets/images/myfolder/a.png
。我想在api中返回圖片網址。那麼,如何在控制器中獲得這個路徑? 我已經嘗試過以下在控制器中查看圖像路徑
ActionController::Base.helpers.image_path('myfolder/a.png')
ActionController::Base.helpers.asset_path('myfolder/a.png')
view_context.image_path('myfolder/a.png')
但沒有任何作品。
是否使預編譯的路徑? –
yes..it does ... –
好的,讓我試試。 –