I'm using image_path into 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 is {ico: '/images/docs/pdf.png'}.
When I'm use image_path('docs/pdf.png') in my views, the url is '/docs/pdf.png' and works.
Why in my controller the url is different?
 
    