Quantcast
Channel: Active questions tagged ubuntu - Stack Overflow
Viewing all articles
Browse latest Browse all 6031

Rails 7 - how to open a text file that is located on disk in Ubuntu?

$
0
0

I am running my Rails app on the Ubuntu server. The structure of files on the disk is this:

/home  /dokku/my-rails-app  /text-files/txt/my-file.txt

In /home/dokku/my-rails-app is my Rails app and I would like to open in this app the /home/text-files/txt/my-file.txt file.

In the view of my Rails app, I do this:

<%= File.read("/home/text-files/txt/my-file.txt") %>

and it generated error ActionView::Template::Error (No such file or directory @ rb_sysopen - /home/text-files/txt/my-file.txt):

However, if I do the same approach in my development environment (OSX), it works and the file is properly displayed.

I also double-checked the path to the file on Ubuntu is correct and it is - if I SSH to terminal and run cat /home/text-files/txt/my-file.txt, I get the file's content.

Am I overlooking something what prevents the Rails app display the content of the file?


Viewing all articles
Browse latest Browse all 6031

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>