Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serving a static file from a specific URL in rails

Suppose I have a file "example.txt", which lives in my assets/files folder in my Rails app. On production, I can access this file via the url '/assets/example.txt'

How can I set up my routes.rb file so that I can access the contents of example.txt when I simply visit 'example.txt'?

like image 609
jyli7 Avatar asked Nov 24 '13 23:11

jyli7


1 Answers

The easiest method is to place the file in your public directory. By default this serves static assets in most cases.

like image 97
Toby Hede Avatar answered Nov 08 '22 20:11

Toby Hede