Giter VIP home page Giter VIP logo

shrine-fog's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

shrine-fog's Issues

wrong number of arguments (given 2, expected 1) in #url

in shrine-fog (1.0.0) lib/shrine/storage/fog.rb line 39:

signed_url = file(id).url(Time.now + @expires, **options)

In fog-google (0.6.0) lib/fog/storage/google_xml/models/file.rb line 130:

        def url(expires)
          requires :key
          collection.get_http_url(key, expires)
        end

Looks like the url method doesn't take options any more.

UPDATE: Same problem in fog-google version 1.3.3

CDN URL support missing

Hi,

I'm trying to use this gem with fog-rackspace 0.1.5 and uploads are working, but then all the files are referencing the API endpoint http://storage101.syd2.clouddrive.com/v1/MossoCloudFS_922621/ as the base URL when using attachment_url method on the model, which isn't a publicly accessible path, instead of something public.

Carrierwave uses an independent config called asset_host to generate public URLs, and fog-rackspace has the options :rackspace_storage_url and :rackspace_cdn_url, but not sure if those are accessible/which one would be ideal for this use case?

It looks from the following code lines I think that the URL generation is using the API endpoint path, not something public?

def url(id, **options)
signed_url = file(id).url(Time.now + @expires, **options)
if @public
uri = URI(signed_url)
uri.query = nil
uri.to_s
else
signed_url
end
end

Sorry for explaining that terribly.

no implicit conversion of ActionDispatch::Http::UploadedFile into String

I seem to be getting the following error when submitting my form for my model:

no implicit conversion of ActionDispatch::Http::UploadedFile into String

Some details of my setup are below:

Rails 6.0.2.2
Ruby 2.6.0p0
gem 'fog-backblaze', '> 0.3.0’
gem 'shrine-fog', '> 2.0', '>= 2.0.1’
gem 'shrine', '~> 3.2', '>= 3.2.1'

Model

class Show < ApplicationRecord

include ImageUploader::Attachment(:artwork)

end

Image Uploader

class ImageUploader < Shrine
  plugin :store_dimensions

  Attacher.validate do
    validate_max_size 1010241024
    validate_mime_type %w[image/jpeg image/png]
    validate_extension %w[jpg jpeg png]
  end
end

Shrine.rb

require "shrine"
require "shrine/storage/fog"
require "fog/backblaze"

storeb2 = Fog::Storage.new(
  provider: 'backblaze',
  b2_key_id: ‘###',
  b2_key_token: ‘###',
  b2_bucket_name: ’test',
  b2_bucket_id: ‘###'
)

Shrine.storages[:store] = Shrine::Storage::Fog.new(
  connection: storeb2,
  directory: “test",
)

Shrine.storages[:cache] = Shrine::Storage::Fog.new(
  connection: storeb2,
  directory: “test",
)

Shrine.plugin :activerecord
Shrine.plugin :cached_attachment_data
Shrine.plugin :restore_cached_data
Shrine.plugin :validation
Shrine.plugin :validation_helpers

Controller Code Where it is blowing up

def create
 @show = Show.new(show_params)

  if @show.save
    flash[:notice] = "The new show has been added to your account"
    redirect_to @show
  else
    render :new
  end
end

private

def show_params
  params.require(:show).permit(:title, :artwork)
end

Do you know what this could be?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.