Geoff Wright
Geoff Wright

Reputation: 125

where should I store files in rails?

1) I am downloading datafeeds (xml) files from a URL to unzip/import them into the database. Where should I store them in the rails file structure?

2) How does the rails file structure work, can rails access the entire hosting environment? I basically mean, if I store my XML feed in /lib/files would I use that path in my models, or the longer full linux path?

Appreciate any advice!

Upvotes: 2

Views: 661

Answers (1)

thekindofme
thekindofme

Reputation: 3866

  1. You should probably use the tmp/ folder to store those temporary files
  2. Its a good practice to always use the full path. You can get the rails root dir via Rails.root

Rails can access any thing that the user account under which the rails process is running, can access. ie: if you run the rails server process under root (which is not a good idea BTW), the app could access any path that root can access. This might of course be limited by whatever access control mechanisms in place by the OS(ex: SELinux).

Upvotes: 4

Related Questions