{"action":"created","issue":{"url":"https://api.github.com/repos/rubytaiwan/AMA/issues/61","labels_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/61/labels{/name}","comments_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/61/comments","events_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/61/events","html_url":"https://github.com/rubytaiwan/AMA/issues/61","id":112327165,"number":61,"title":"production中，放在shared資料夾的檔案路徑問題","user":{"login":"jcsky","id":11516354,"avatar_url":"https://avatars.githubusercontent.com/u/11516354?v=3","gravatar_id":"","url":"https://api.github.com/users/jcsky","html_url":"https://github.com/jcsky","followers_url":"https://api.github.com/users/jcsky/followers","following_url":"https://api.github.com/users/jcsky/following{/other_user}","gists_url":"https://api.github.com/users/jcsky/gists{/gist_id}","starred_url":"https://api.github.com/users/jcsky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jcsky/subscriptions","organizations_url":"https://api.github.com/users/jcsky/orgs","repos_url":"https://api.github.com/users/jcsky/repos","events_url":"https://api.github.com/users/jcsky/events{/privacy}","received_events_url":"https://api.github.com/users/jcsky/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rubytaiwan/AMA/labels/Rails","name":"Rails","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-20T09:45:22Z","updated_at":"2015-10-20T09:58:54Z","closed_at":null,"body":"為了存放一些deploy時不被覆蓋掉的資料\r\n我建了一個 data 的資料夾在Rails根目錄下 ( /Rails_app/data )\r\n利用 capistrano-passenger deploy\r\n在 deploy.rb 中把data加到了 linked_dirs\r\n`set :linked_dirs, fetch(:linked_dirs, []).push('log', 'tmp/pids', 'tmp/cache', 'tmp/sockets', 'vendor/bundle', 'public/system', 'data')`\r\n並且在ubuntu server 上，把 data 放到 shared 目錄下\r\n\r\n問題來了.. \r\n我的程式碼中，為了要讀取 data中的 xml 檔，在controller這麼寫\r\n```\r\nfilename = Rails.root + \"data\" + ( params[:date]+\" xmlfile\" ) + params[:file]\r\nrender xml: filename, content_type: \"application/xml\"\r\n```\r\n在 local 的 develop mode，我可以得到正確路徑\r\n但在 production 上，Rails.root會得到以下路徑而造成錯誤\r\n`/home/deploy/rails_app/releases/20151020090647/data`\r\n\r\n請問我應該怎麼寫才能在production mode 得到正確路徑呢??"},"comment":{"url":"https://api.github.com/repos/rubytaiwan/AMA/issues/comments/149502698","html_url":"https://github.com/rubytaiwan/AMA/issues/61#issuecomment-149502698","issue_url":"https://api.github.com/repos/rubytaiwan/AMA/issues/61","id":149502698,"user":{"login":"zackexplosion","id":5180966,"avatar_url":"https://avatars.githubusercontent.com/u/5180966?v=3","gravatar_id":"","url":"https://api.github.com/users/zackexplosion","html_url":"https://github.com/zackexplosion","followers_url":"https://api.github.com/users/zackexplosion/followers","following_url":"https://api.github.com/users/zackexplosion/following{/other_user}","gists_url":"https://api.github.com/users/zackexplosion/gists{/gist_id}","starred_url":"https://api.github.com/users/zackexplosion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zackexplosion/subscriptions","organizations_url":"https://api.github.com/users/zackexplosion/orgs","repos_url":"https://api.github.com/users/zackexplosion/repos","events_url":"https://api.github.com/users/zackexplosion/events{/privacy}","received_events_url":"https://api.github.com/users/zackexplosion/received_events","type":"User","site_admin":false},"created_at":"2015-10-20T09:58:54Z","updated_at":"2015-10-20T09:58:54Z","body":"你是在 Server 上 建立了一個 Data 資料夾還是在你的開發機?"}}