I have an rails application that needs to read a file from its own
directories. Say I put in in the config folder, and call it
sometext.txt. In a controller I have
f = File.new(File.join(RAILS_ROOT, ‘config’, ‘sometext.txt’))
then text = f.read gets me the information.
This works fine in my development environment, with the side effect that
the file contents also get printed to my console. However, this seems to
cause a big problem when I deploy the application. The production server
does not want to have any print activity, so, I get an error statemtn
that Rails application did not start successfully - same as if I had
left a puts statement somewhere in the code.
There must be a straight-forward way to read the file without any output