Reputation: 87
In my local, I have written
<%= link_to 'App', "/App.apk", data: { no_turbolink: true } %>
It is working fine simply downloading App.apk file which is present in public folder
But on production, the same link gives the error
Not Found
The requested URL /App.apk/ was not found on this server.
Can anyone give me any idea why this is behaving differently on different environment
Thankyou in advance
Upvotes: 4
Views: 5536
Reputation: 7361
Instead of adding path in direct link, create one action which download the file from public folder.
routes.rb
get 'download_apk'
in your controller add below action which downloads apk file
def download_apk
send_file("#{Rails.root}/public/App.apk")
end
Upvotes: 9