Serving a static file from a specific URL in rails

Suppose I have an example.txt file that is located in my resources / files folder in my Rails application. In production, I can access this file through the url '/assets/example.txt'

How can I configure the routes.rb file so that I can access the contents of example.txt when I just find "example.txt"?

+6
source share
1 answer

The easiest way is to place the file in a public directory. By default, in most cases, these are static assets.

+9
source

Source: https://habr.com/ru/post/958744/


All Articles