开发者

Heroku rake db:seed permission denied when opening .xls with spreadsheet gem

I have been using the spreadsheet gem from http://spreadsheet.ch/ to read in seed data to a Rails 3 application.

I was using

Spreadsheet.open "xxxx" 

which ran fine on my dev machine but 开发者_JAVA技巧when pushed to Heroku errored with "Permission denied"

The guide http://spreadsheet.rubyforge.org/files/GUIDE_txt.html is only very basic help.


Down we go into the 'long series of debugging questions' rabbit hole:

"Is the spreadsheet checked into git, such that it would show up on Heroku?"

"Is ruby spreadsheet trying to write to a file that's in one of the read only parts of heroku?"

"Are you using Spreadsheet.open or ?"

I guess in general it would be nice if you could include a stack trace of the error Heroku is giving you.

Perhaps: heroku logs within your project directory might be of help, if the errors are recorded there?


Chalk this one up to duh

Spreadsheet by default opens in read/write which Heroku does not allow. A little ri research revealed that Spreadsheet.open can be passed the 'r' flag for read-only. Here is the ri output

>>ri Spreadsheet.open
Spreadsheet.open

(from gem spreadsheet-0.6.5.4)
------------------------------------------------------------------------------
open(io_or_path, mode="rb+", &block)

------------------------------------------------------------------------------

Parses a Spreadsheet Document and returns a Workbook object. At present, only Excel-Documents can be read.
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜