CSV filepath

Henry Bourne wrote:

When I run this i get an error saying "No such file or directory - students.csv". The csv file is in the "public" directory generated by the rails app. what am I doing wrong? How can I get the path to the public directory?

Try passing this:

File.join(File.expand_path(RAILS_ROOT), "/public/students.csv")

to generate the full path to your file.

The File.expand_path() part may not be necessary on your system... sometimes I need it and sometimes I don't. :slight_smile:

Jeff softiesonrails.com