I have inside app
a directory called csv
and inside this dir I have a file called names.csv
I want to use File.read(path:string)
You should do: Rails.root.join "app", "csv", "names.csv"
Rails.root returns a PathName object. PathName has a join
method which takes any number of arguments and appends it to the pathname to create the new path.
Read on PathName#join here:
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/pathname/rdoc/Pathname.html#method-i-join