![](/img/trans.png)
[英]cant find spreadsheet on GoogleDrive which was created by google_drive gem / learn-rails tutorial
[英]GoogleDrive::Error (Updating cell has failed: Missing resource version ID) (Rails 3 / gem 'google_drive')
我最近收到此错误:
Completed 500 Internal Server Error in 7609ms
GoogleDrive::Error (Updating cell https://spreadsheets.google.com/feeds/.../od6/private/full/R1C1 has failed: Missing resource version ID)
我什么都没改变,以前效果很好。
使用: Rails 3, gem 'google_drive'
码:
def google_report
session = GoogleDrive.login(current_user.gmail, ActiveSupport::MessageEncryptor.new(SECRET).decrypt(current_user.gmail_pass))
asin = params[:asin]
@i_all = Item.where(:user_id => current_user.id, :asin => asin, :domain => params[:domain]).order("created_at desc")
# + 9 hours cuz of server time
time = (Time.now + 9.hours).strftime("%Y-%m-%d %H:%M:%S")
session.create_spreadsheet(asin + " " + time)
ws = session.spreadsheet_by_title(asin + " " + time).worksheets[0]
ws[1, 1] = "商品名"
ws[1, 2] = "ASIN"
...
@i_all.try(:each_with_index) do |i, index|
ws[index+2, 1] = i.title
ws[index+2, 2] = i.asin
...
begin
ws.save()
rescue GoogleDrive::Error
ws.save()
next
end
end
ws.save()
end
我认为解决方法是添加一个版本
https://developers.google.com/google-apps/spreadsheets/#specifying_a_version
我认为这是可选的,但他们要求这样做。
更新gem可以达到目的:)
从google_drive (0.3.7)
到google_drive (0.3.9)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.