Ask A Question

Notifications

You’re not receiving notifications from this thread.

Shrine uploading image to google drive

Misel Ademi asked in Rails

Hi,

I am trying to upload images to google drive using Shrine. I followed instructions from this gem
https://github.com/verynear/shrine-google_drive_storage

I added this gems to my project

gem 'shrine'
gem 'shrine-google_drive_storage'

This is my config/shrine.rb

require "shrine"
require "shrine/storage/google_drive_storage"

Shrine.storages = {
  cache: Shrine::Storage::GoogleDriveStorage.new(prefix: "cache"),
  store: Shrine::Storage::GoogleDriveStorage.new(prefix: "store"),
}

Shrine::Storage::GoogleDriveStorage.new(
  prefix: "store",
  google_drive_client_secret_path: "#{Rails.root}/config/client_secret.json",
  drive_public_folder_id: '0Bz_kkknizZmZRXZzeXdua1FNUXc',
  google_drive_options: {
        path: proc { |style| "#{id}_#{photo.original_filename}_#{style}" },
      },
)

but when I try to upload image I get this error message

NameError (undefined local variable or method `content_type' for #Shrine::Storage::GoogleDriveStorage:0x00000004009868):

Does somebody know where I made mistake?

Thanks

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 76,990+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.