I am new in ruby on rails and I want to read file names from a specified directory. Can anyone suggest code or any other links?
Thanks
For security reason, you can not access a file outside project rails from URL without defining a route. What you can do, is point a route to controller that, based on file name provided at url, require a file outside rails project.
I suggest you use Dir.entries("target_dir")
Check the documentation here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With