Questions tagged [rails-activestorage]

Active Storage is a component of Ruby on Rails. It facilitates uploading files to a cloud storage service like Amazon S3, Google Cloud Storage, or Microsoft Azure Storage and attaching those files to Active Record objects.

0
votes
1answer
21 views

Rails: ActiveRecord::RecordNotFound Couldn't find Photo without an ID

I have two models, Services and Photos. Under service model belongs_to :user and has_many :photos and has_many_attached :images. Under photo model belongs_to :service Under the Photos viewer I'm ...
0
votes
0answers
14 views

how to access specific ActiveStorage image in multiple images

I am using ActiveStorage for Ruby on Rails project. A post has many images and I want to use the one of images with headline. I am wondering how to access specific image in multiple images. Current ...
0
votes
1answer
14 views

Manual uploads using Active Storage with JSON

I am trying to make a general files uploader for all the files and images for my Rails app. The uploader function is the same like the popular JS uploaders such as Filestack or Uppy Uploader, where ...
0
votes
2answers
27 views

Migrating Carrierwave to ActiveStorage

I have an application using Carrierwave to handle file uploads but really love the simplicity of ActiveStorage. There are plenty of tutorials on migrating from Paperclip to ActiveStorage with the ...
0
votes
1answer
18 views

Unable to display image using variant with ActiveStorage image_processing gem

Currently I'm working on a Rails 5.2 application. When I try to display a profile's avatar in a show.html.erb template using variant it doesn't work <%= image_tag @profile.avatar.variant(...
0
votes
0answers
15 views

disable checksum rails active storage paperclip migration aws s3

Is there a way to disable checksum with active storage? I am migrating from paperclip to active storage, using amazon s3 storage. There is no way to get the get the md5 checksum encryption code ...
0
votes
0answers
13 views

Caching ActiveStorage images in background jobs / PDF documents?

I generate PDF tickets using Prawn, and I will, for example, insert an active storage image like this: def image_data(attachment) StringIO.new attachment.download end image image_data(...
0
votes
0answers
21 views

Is it possible to add meta data when files are uploaded to s3?

I want to add meta data on a per object basis when files are uploaded to s3 using active storage direct upload. For example, I want to add meta data on each object so I know which users are uploading ...
0
votes
1answer
14 views

How can i reference the DirectUpload js class from my jQuery block?

My layout has: //= require activestorage Now in my jQuery I am trying to reference the DirectUpload class: // Instantiate the DirectUploader object const upload = new DirectUpload(file, url) ...
1
vote
1answer
20 views

How to trigger the file upload on the client side and not on form submission?

I have a working version of the active-storage example using s3 found here: https://edgeguides.rubyonrails.org/active_storage_overview.html Now I want to be able to perform the file upload not when ...
1
vote
0answers
27 views

How to disable auto generated routes by Active Storage

I am upgrading an existing application to Rails 5.2. Old application is using Paperclip for file storage and I am trying to move that to ActiveStorage. My app expose an API that allows users to ...
0
votes
0answers
22 views

ActiveModel::UnknownAttributeError unknown attribute 'avatar' - ActiveStorage

Currently I'm trying to attach an :avatar field on a Profile. I get the following error: However, following the docs I added the relationshipt of :avatar to Profile. models/profile.rb class Profile &...
1
vote
0answers
26 views

Rails ActiveStorage Images not appearing for custom domain?

ok this is weird.. I have a multi tenancy app which works perfectly. The app uses ActiveStorage and DigitalOceans Spaces to host images. I then use a custom domain to point to the subdomains. ...
0
votes
0answers
11 views

Displaying Images in rails admin with active storage

How do i display my images in the rails admin view, edit and show actions? Here is my code rails_admin.rb config.model 'Event' do edit do field :images, :multiple_active_storage end ...
0
votes
1answer
40 views

Why does active_storage:install's migration (v5.2.1) generate invalid MySQL syntax when run?

I've upgraded a Rails 4.x app to v5.2.1. The upgrade went fine and the app runs well. However, I've now run rails active_storage:install, which creates a migration to create the tables for ...
0
votes
0answers
10 views

Can you make Video variants, transformations of video, with ActiveStorage?

ActiveStorage seems to be mostly focused on images. While it does offer "preview" support to get a thumbnail from a video -- what about "variants"? With images, maybe it's uploaded as a JPG, but I ...
0
votes
1answer
19 views

How to query records that have an ActiveStorage attachment?

Given a model with ActiveStorage class User has_one_attached :avatar end I can check whether a single user has an avatar @user.avatar.attached? But how can I return a collection of all users ...
2
votes
0answers
83 views
+50

ActiveStorage Image Upload Error with Rails 5.2: signed_id delegated to attachment, but attachment is nil

I'm having an issue with image/pdf uploads with ActiveStorage. The images appear to be uploading without issue, but they are causing errors when I try to show them. My blog model has_one_attached :...
0
votes
0answers
18 views

ActiveStorage returns an InvalidSignature conflict on create

I am using Feedjira to parse RSS feeds and create Event records. I had great success with creating the records at first using a title, description, url and published_at stamp. Last evening I created a ...
0
votes
0answers
11 views

Can you _remove_ a variant from ActiveStorage?

Using ActiveStorage in Rails, variants are added "on demand" as you create them. They are now persisted in some storage (disk, S3, google cloud, etc). If you realize some variants are un-needed ...
0
votes
0answers
36 views

How to upload file in nested form using ActiveStorage?

I have Project that has many Tasks. Each Task can have an image uploaded using ActiveStorage. In my Project new view I have dynamically created nested forms (via Cocoon) to create new tasks and ...
0
votes
1answer
24 views

Issue to open credentials file

I am trying to open credentials file with this command. rails credentials:edit It returns : No $EDITOR to open file in. Assign one like this: EDITOR="mate --wait" bin/rails credentials:edit ...
0
votes
0answers
19 views

Why is ActiveStorage with S3 raising InvalidBucketName

I've just added ActiveStorage to a Rails app using S3. My first use of AS on a staging env raises Aws::S3::Errors::InvalidBucketName: The specified bucket is not valid. The bucket already exists on ...
0
votes
1answer
36 views

'method_missing': undefined method `active_storage' for (NoMethodError)

I currently generated a Ruby on Rails 5.2 application. When I run rails active_storage:install it created a 20180915211415_create_active_storage_tables migration. However, I run into the following ...
0
votes
1answer
25 views

Can ActiveStorage::PurgeJob be enqueued to other than `default`?

There wasn't any queue named default in our Rails code. But it seems Sidekiq sets queue for ActiveStorage::PurgeJob as default. That was why purge_later never worked. [ActiveJob] Enqueued ...
1
vote
0answers
21 views

Recording audio and submit to ActiveStorage

I have a Rails form with a file field pointing to ActiveStorage. Using the MediaRecorder API (and a polyfill for Safari), I have also built an audio recorder. So far so good: the recorded audio can ...
0
votes
0answers
31 views

When is ActiveStorage::IntegrityError raised?

My app (locally) raises ActiveStorage::IntegrityError error, whenever it tries to attach a file. How can I get out of this error? I have only one has_one_attached and I don't know how that error gets ...
0
votes
0answers
12 views

Rails_admin and Active_storage

I am trying to upload multiple files through Rails_Admin with Active_Storage. Here is my code : belongs_to :driver has_one_attached :avatar has_many_attached :pictures attr_accessor :...
0
votes
0answers
13 views

Rails ActiveStorage attachment to existing S3 file

I'm building a PDF parser that fires off a Sidekiq worker to OCR parse data from a document stored in S3. After parsing, the data is stored in the Document model. How do I append the existing S3 ...
1
vote
1answer
27 views

Rails 5.2.1: File input being replaced by text inputs - ActiveAdmin nested attributes form

How can I stop my file input field being replaced by my text input fields? Versions: Rails 5.2.1 ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux] rvm 1.29.4 I am using an ...
0
votes
1answer
50 views

Using Cloudfront with Active Storage

I am building a website using Ruby on Rails. To upload images I am using Active Storage and Amazon S3. All's good here. Users can upload images and images are viewable on the website (images are ...
0
votes
0answers
36 views

Seeding images with active storage

I recently implemented Active Storage into my rails 5.2 project and I'm encountering a problem when seeding users with an avatar: user = User.new( email: "[email protected]", password: 123456, ...
2
votes
2answers
46 views

List ActiveStorage attachments indirectly related to model

I am new to Rails and am trying to understand how ActiveStorage works. The app has the following models: class Client < ApplicationRecord has_many :jobs has_many :messages end class Job &...
0
votes
1answer
28 views

ActiveStorage with ActiveJob and Apartment gem deserialization error

I am trying to use the Apartment gem with activestorage and activejob but I am running into an error with the default activestorage analysis task. I have a simple controller that uploads and stores ...
0
votes
1answer
57 views

ActiveStorage : Why not using service_url instead of blob/variant/preview url (302 redirect)?

In Rails 5.2, Active Storage gives us the ability to generate permanent urls that are redirecting to an asset, via unique signed urls at each call. html: <img src='/rails/active_storage/blobs/ey......
0
votes
1answer
24 views

Error with .webp images when using Active Storage on Heroku

When I use Active Storage, and when someone upload a .webp image, and when I run file.attach(io: webp_file, filename: 'file.webp') it works, and then ActiveStorage automatically run a job ...
0
votes
1answer
77 views

Active Storage purge method throws undefined method signed_id for NilClass

I have a problem similar to the question here but dropping the database isn't a viable solution for my project: Rails 5.2 ActiveStorage undefined method `signed_id' for nil:NilClass I have a ...
0
votes
0answers
32 views

How do you use ActiveStorage has_many_attached i active admin when editing images on a model?

I am using Active admin for editing all models in my app, and have previously used paperclip. In this app I am using Active Storage on and Activity model with the following: has_many_attached :images ...
1
vote
1answer
53 views

How can I upload an image to S3 with rails' Active Storage from a <canvas /> in a rails form?

As stated in the title I'm trying to upload an image to my S3 bucket with rails' Active Storage from a element that is nested within a rails form. So far I've been able to use <%= f.input :...
1
vote
1answer
29 views

Mute ActiveStorage Logs

ActiveStorage floods my dev logs so i'm drowning in requests for images on a page. Is there a way to mute active storage or atleast reduce the log entries so that I can use my logs again? For example,...
0
votes
0answers
21 views

Getting broken link on using activestorage with s3 and delayedjob on rails 5.2

So I have the following setup in my dev environment and have amazon upload enabled for testing purposes aws s3 rails 5.2 (latest) active storage (latest) gem "aws-sdk-s3", require: false When do a ...
0
votes
0answers
22 views

Activeadmin - activestorage delete edit multiple photos

I'm trying to find a way to delete the images uploaded from activeadmin using activestorage. I managed to show all the images in the show view and the edit of the resource but i can't seem to find the ...
0
votes
3answers
57 views

Rails Activestorage and S3, storing sensitive data

ActiveStorage makes possible to upload and access files directly on S3 through the user browser in JS. Does it means that your S3 credentials are embedded into the user browser? I think I ...
0
votes
1answer
59 views

Adding image to seed database in rails 5.2 active storage

Just trying to add an image to my seed file. Having a little issue when trying to add using the new active storage in Rails 5.2 Can anyone spot what's happening. Here is the code followed by error in ...
0
votes
1answer
80 views

How can I access an ActiveStorage object via URL in a test environment?

Given a model that has an ActiveStorage attachment class MyObject has_one_attached :avatar end In a dev environment I am able to retrive the avatar as a StringIO object. obj = MyObject.new( { ...
1
vote
0answers
33 views

Active Storage S3 Delivery Domain

I've been trying to implement active storage in an existing app, and I've been running into an issue. Using a url_for generated URL, the given url is a rails blob URL which then redirects to S3. ...
0
votes
0answers
25 views

How to migrate from Refile to ActiveStorage?

Any idea how to migrate a running project using Refile to the new rails's Active Storage? Anyone knows any tutorial/guide about how to do that? Thanks, Patrick
0
votes
1answer
79 views

Rails: undefined method `signed_id' for #<ActiveStorage::Attached::Many:casualID>

I'm on Ruby 2.4.1-rc2 and Rails 5.2.1 and I'm using active storage. File uploading is perfect, but when I try to recall a file download url with rails_blob_path(user.avatar, disposition: "attachment", ...
1
vote
0answers
33 views

Accept an image via Rails 5 API and Active Storage

I am trying to send images to my Rails app and then store them via Active Storage. I tried Base64 and direct upload and researched for hours but nothing really works. Can somebody point me to a good ...
0
votes
1answer
19 views

Active Storage: Update S3 on Model Update, Delete S3 on Model Delete

I am using Active Storage on Rails 5.2.1 I have followed the tutorial and I am using the credentials to set it up in my storage.yml amazon: service: S3 access_key_id: <%= Rails.application....