Questions tagged [shrine]

Shrine is a file upload toolkit for Ruby, it's designed to be simple, extensible, secure and fast, and provides an abstraction for different storages.

Shrine is a file upload toolkit for Ruby with the following characteristics:

  • It's composed entirely out of plugins, making it very extensible and flexible

  • It makes direct AJAX uploads to the application or S3 dead easy

  • It's designed from day one with backgrounding in mind (Sidekiq, Resque etc.), but it still retains seamless user experience

  • It provides a simple instance-level interface for file processing and validations

  • It comes with filesystem and S3 storage, but provides nice abstraction for other storages as well

It was created and is currently maintained primarily by Janko Marohnić.

141 questions
3
votes
3 answers

Inheriting from class Module

I am trying to understand the shrine gem source code that is a toolkit for file attachments. You can define an uploader on your model in rails like so: class Picture < ApplicationRecord include ImageUploader::Attachment.new(:image) end The…
trueinViso
  • 1,354
  • 3
  • 18
  • 30
3
votes
1 answer

Rails 5 + Shrine multiple files upload

I am trying to implement multiple files upload using polymorphic association and Shrine. class Campaign < ApplicationRecord has_many :photos, as: :imageable, dependent: :destroy accepts_nested_attributes_for :photos, allow_destroy:…
Anton
  • 540
  • 3
  • 13
3
votes
1 answer

Shrine with Rails multiple polymorphic image uploads

I've been struggling for about 5 hours trying to understand why Shrine is blocking my uploads. I either get errors like "Shrine: Invalid file", or "Expected Array but got string" in strong params. If there aren't errors, the images aren't actually…
Kevin Brown
  • 12,602
  • 34
  • 95
  • 155
2
votes
1 answer

rails file_field not showing

I would like to make my app upload multiple files with Shrine, but one doc suggests two file_fields whereas the other suggests only one. After posting a question to their discourse forum, it was suggested that I hide the one named files[]. Whether I…
calyxofheld
  • 1,538
  • 3
  • 24
  • 62
2
votes
3 answers

Shrine gem - how to prevent deletion of uploaded files from S3

I'm using shrine gem for storing images in S3 by Ruby on Rails. How can I make shrine behave as follows? 1. When uploading files from Frontend, they are stored in S3. 2. When deleting files from Frontend, they are deleted from Database, "but not…
2
votes
2 answers

New to Shrine. What is the use of the cache?

I'm currently using Shrine to upload files to DigitalOcean (via s3 sdk). It works nicely, it's perfect. However, in the guide there's a storage option to make a temporary copy of the uploads, specified by the 'cache' prefix. How is this cache used?…
dev404
  • 1,088
  • 13
  • 34
2
votes
0 answers

How to upload file on server disc to S3 with Shrine and make it public?

I want to upload file located on disk to S3 and make it public. obj.file_attacher.assign(File.open(processed_file, binmode: true), upload_options: { acl: "public-read" }) Upload works but file is not public. obj.file_url returns:…
knagode
  • 5,816
  • 5
  • 49
  • 65
2
votes
2 answers

Shrine::Error: storage :cache isn't registered on FileUploader

Im using Mongoid 6.0.3, ruby 2.3.1 and rails 5.2 I created a file_uploader class for handling my uploads using shrine. /app/uploaders/file_uploader.rb class FileUploader < Shrine Attacher.validate do validate_max_size 5.megabytes,…
ashusvirus
  • 412
  • 7
  • 22
2
votes
1 answer

Shrine.rb - How to access the file path / raw file after it's been uploaded

I have some other tasks that can be performed on images. Like for instance selecting multiple images, and combining them into a single image. I have that part working with RMagick and local files, and I have the upload part working with Shrine, but…
Peter R
  • 3,185
  • 23
  • 43
2
votes
1 answer

Heroku, Shrine and Amazon S3: Blog post Images disappear after some time

I have a blog page I developed using rails 5.1. Everything works just fine, except that after I create a post in production and attach an image, the image stops showing after a while (say 30 minutes). I scouted around the internet looking for…
Chidozie Nnachor
  • 872
  • 10
  • 21
2
votes
0 answers

How to get Angular 5 temple name attribute to match Rails 5 attachment attribute

I am working on an application the uses a Angular 5 frontend and the Rails 5 backend. Both are APIs that communicate through JSON. Further, for uploading I am using the Shrine gem with Uppy. To get uploading up and running I followed these two…
user3799793
  • 131
  • 3
  • 11
2
votes
2 answers

Rails: Testing file upload validation (Shrine gem) at model spec

The following code tests image validation within a model spec in a Rails 4.2 app with RSpec 3.5 and the Shrine gem for file uploads. My questions are: Can you think of a way to improve the following tests or a better way to test those…
BrunoF
  • 3,239
  • 26
  • 39
2
votes
1 answer

Handling File Uploads from Mobile Application to a Rails End Point using Shrine

So I have a Rails Application which uses Shrine as its File Uploader. The same app has a mobile client which can click and send pictures. Currently, the mobile is clicking pictures and sending them to AWS S3 and then returning the S3 URL back to…
2
votes
2 answers

Limit total size (MBs) of uploads per user to AWS S3 (using Shrine)

I am working on a Rails application that allows users to upload their images to AWS S3 via shrine. The setup so far works just fine - however, I was wondering if there is any straight forward of extracting the total size of uploads per user. For…
Georg Keferböck
  • 1,967
  • 26
  • 43
2
votes
1 answer

Making each account have a separate S3 bucket for attachments using Shrine

In our Ruby I would like that each account has a separate S3 bucket for its attachments. I would also like that bucket names can be derived from account's attributes: Account(id: 1, username: "johnny") # uses the "1-johnny" bucket Account(id: 2,…
Janko
  • 8,985
  • 7
  • 34
  • 51
1
2
3
9 10