开发者

where should I store files in rails?

开发者 https://www.devze.com 2023-03-02 17:23 出处:网络
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?

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 rai开发者_运维百科ls 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!


  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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号