Rails 4.2 image_path with different url for controller
I am using image_path in my controller:
class ArchivesController < ApplicationController
include ActionView::Helpers::AssetUrlHelper
def create
@archive = Archive.new(file: params[:file])
render json: {ico: image_path('docs/pdf.png')}
end
end
But my return {ico: '/images/docs/pdf.png'}
.
When I use image_path('docs/pdf.png')
in my views the url is "/docs/pdf.png" and it works.
Why is the url different in my controller?
+3
source to share