Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何在rails中使用回形针googledrive显示来自google驱动程序的图像_Ruby On Rails_Ruby_Ruby On Rails 4_Ruby On Rails 3.2_Google Drive Api - Fatal编程技术网

Ruby on rails 如何在rails中使用回形针googledrive显示来自google驱动程序的图像

Ruby on rails 如何在rails中使用回形针googledrive显示来自google驱动程序的图像,ruby-on-rails,ruby,ruby-on-rails-4,ruby-on-rails-3.2,google-drive-api,Ruby On Rails,Ruby,Ruby On Rails 4,Ruby On Rails 3.2,Google Drive Api,当我得到一张图片时,我想在谷歌驱动程序中显示一张来自公用文件夹的图片 Product.first.image.url #=> ArgumentError: Missing access token. 我认为它没有得到谷歌驱动路径 产品模型 class Product < ActiveRecord::Base has_attached_file :image, :storage => :google_drive,

当我得到一张图片时,我想在谷歌驱动程序中显示一张来自公用文件夹的图片

Product.first.image.url
#=> ArgumentError: Missing access token.
我认为它没有得到谷歌驱动路径

产品模型

class Product < ActiveRecord::Base
  has_attached_file :image,
                    :storage => :google_drive,
                    :google_drive_credentials => "#{Rails.root}/config/google_driver.yml",
                    :styles => { :medium => "300x300", :thumb => "100x100", :large => "800x600" },
                    :google_drive_options => {
                    :path => proc { |style| "#{style}_#{id}_#{image.original_filename}" },
                      :public_folder_id => '0B0VNyOkzIwUZQjFRU2NUX3pYSGs'
                    }
  end
类产品:谷歌硬盘,
:google_drive_credentials=>“#{Rails.root}/config/google_driver.yml”,
:style=>{:medium=>“300x300”,:thumb=>“100x100”,:large=>“800x600”},
:google\u drive\u options=>{
:path=>proc{style}“{style}{id}}{image.original{u filename}”,
:public_folder_id=>“0B0VNyOkzIwUZQjFRU2NUX3pYSGs”
}
结束

首先,我对ruby不太了解,但我知道google drive。
因此,您试图读取该文件,但首先需要访问令牌。也许你需要了解如何使用Ruby,这里有一个Ruby的基本示例

获得凭据后,需要对文件进行查询搜索或尝试读取文件。你可以读到它


最后,一旦你有了你的图像文件,也许你正在寻找的属性就是webContentLink。我可以在网络浏览器中显示图片。

首先,我对ruby不太了解,但我知道google drive。
因此,您试图读取该文件,但首先需要访问令牌。也许你需要了解如何使用Ruby,这里有一个Ruby的基本示例

获得凭据后,需要对文件进行查询搜索或尝试读取文件。你可以读到它

最后,一旦你有了你的图像文件,也许你正在寻找的属性就是webContentLink。我能够在网络浏览器中显示图片