views:

197

answers:

1

I want to a list of emails in a text file outside of my repository and doc root in ROR. But I need the application to write to it. What is the best way to accomplish this? My guess is a sym link but I'm not sure.

I am also curious about where I should keep this text file. It is a list of emails to invite people to use my service.

Thanks!

+4  A: 

The filename that you write to doesn't need to be within your source tree. As long as you have a path to the file and the permissions are correct, you should be able to write to anywhere that you want.

After verifying the email, you could do something as simple as:

File.open("/home/path/or/something/emails.txt", 'a') {|f| f.write("#{email}\n") }

In terms of whether you should keep it in a text file, if it works for you, why not? You could use a database, but that seems like more overhead than you need to store a list of emails.

Benny Wong