stergosz
stergosz

Reputation: 5860

ruby on rails how to add files to a folder for direct use

I want to add some .c files manually in my website for others to be able to see them with a direct link in their browser...

Where do i add these files and how can i link to them in a view file?

Do i simply create a folder in the assets or in the root of the site and link manually like

http://www.mysite.com/path/to/file?

is it possible to make this use routes like

this_route_path()

Upvotes: 0

Views: 419

Answers (1)

HungryCoder
HungryCoder

Reputation: 7616

If you put your files in public directory in your rails project, it will be available to world. And if configured, the front end servers (web servers) can directly serve them without loading rails stack.

For example, if you keep test.txt in public directory, you can access it like http://127.0.0.1:3000/test.txt. You can make your own directory structure inside the public directory and format the URL accordingly.

Upvotes: 2

Related Questions