rails-activestorage Questions

4

Solved

I am having an issue with Active Storage. When I upload to Amazon S3, instead of saving the file inside the bucket with the original name like myfile.zip it is saving it as the key which is associa...

8

Solved

I want to get list of records with attached images as a links or files by api. I have a simple model: class Category < ApplicationRecord has_one_attached :image validates :name, presence: tr...

5

Solved

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 us...
Didst asked 20/9, 2018 at 5:23

4

Solved

I have a Rails 6 app that uses Active Storage to store multiple images to a model (Activity) with has_many_attached. I don't understand how to append extra images instead of replacing the existin...
Mande asked 18/1, 2020 at 19:13

4

Solved

So I decided to add an url attr_accessor to ActiveStorage::Attachment objects. In development the patch holds for a while until it seems to "have been lost". Meaning it works for few minutes, then...

3

Currently I'm trying to display .HEIC images in Rails 6. I'm using ActiveStorage ImageMagic to use variant to display jpg. Basically I'm trying to use mogrify -format jpg myimage.heic In the im...
Laurynlausanne asked 14/3, 2020 at 18:52

7

Earlier my files were uploading in the storage folder. But now I want to upload images on the s3 bucket. how can I migrate my existing local data on the s3 bucket? I found the script here https://...
Cathedral asked 24/6, 2019 at 11:45

2

I'd like to use Rails as a backend to a mobile app (Android and maybe iOS), and one of the requirements is file upload. I haven't been able to find any resources on using Activestorage with direct...
Machination asked 6/4, 2018 at 9:0

7

Solved

I have a model that is using ActiveStorage: class Package < ApplicationRecord has_one_attached :poster_image end How do I create a copy of a Package object that contains a duplicate of the i...
Shape asked 3/4, 2018 at 13:35

4

Solved

According to Rails (edge6.0) guides, we can do maintenance work for ActiveStorage used in System Test and Integration Test by calling the following statement respectively # System Test FileUtils....
Worst asked 8/10, 2020 at 14:18

5

Solved

I have a Rails 5.2.3 app using ActiveStorage. By default, ActiveStorage would run some background jobs to extract metadata from attached files, and/or create thumbnail images for previews. I don't...
Leopoldine asked 4/6, 2019 at 14:23

7

Solved

Is there a callback for active storage files on a model after_update or after_save is getting called when a field on the model is changed. However when you update (or rather upload a new file) no ...
Lobscouse asked 9/11, 2018 at 13:2

6

Solved

With a standard S3 configuration: AWS_ACCESS_KEY_ID: [AWS ID] AWS_BUCKET: [bucket name] AWS_REGION: [region] AWS_SECRET_ACCESS_KEY: [secret] I can upload a file to S3 (using direct upload) with ...

4

I'm trying to seed my development database. One of the models Project has images associated with it. I have put a placeholder image in ./db/seed_files/. My seed file looks like this: # Add projec...
Hutson asked 9/3, 2019 at 15:1

4

I'm getting an error testing the ActiveStorage attachment. The code is something like this: class AssemblyTest < ActiveSupport::TestCase test 'Updating svg attachment should upload the update...
Porphyritic asked 23/8, 2019 at 21:24

4

Solved

This is an issue that has been going on for quite some time and to this day, I still have not found the solution. I have seen some similar issues but not quite what I have been experiencing. I hav...
Sjambok asked 5/2, 2020 at 20:28

4

Solved

I have a basic ActiveStorage setup with one model that has_many_attached :file_attachments. In a service elsewhere I'm trying to generate a link to be used outside the main app (email, job etc). ...
Metamorphosis asked 30/6, 2018 at 0:28

4

Solved

I have updated my rails api application from 5.1 to 5.2. I am using rails api only. I am trying to use the active storage. I think the problem is due to the line config.api_only = true in config/a...
Gens asked 10/6, 2018 at 6:32

2

I have a simple Rails 6 app with ActiveStorage. I use local disk storage. When I inspect responses from representation url like this http://localhost:3000/rails/active_storage/disk/some-long-hash/I...
Temperature asked 5/12, 2020 at 16:1

3

Solved

I have a Rails model with: has_many_attached :files When uploading via Active Storage by default if you upload new files it deletes all the existing uploads and replaces them with the new ones. I ...
Cianca asked 24/4, 2022 at 16:43

2

Solved

I am trying out Rail 5.2.0.rc1 Active Storage, using its included JavaScript library to upload PDF docs directly from the client to the cloud. But on submitting a form I get a browser error in both...
Galloot asked 20/3, 2018 at 13:22

2

So ActiveStorage works perfectly. I have now turned on CDN on DigitalOcean Spaces, with a personal subdomain like: https://cdn.my-website.com I have been following this Rails official doc which sta...

5

Solved

Is there a way to change/set the filename on download? Example: Jon Smith uploaded his headshot, and the filename is 4321431-small.jpg. On download, I'd like to rename the file to jon_smith__heads...

4

Solved

Using url_for() on a file stored in active storage returns a url that leads to the application and then redirects to the actual location. Because of a bug in firefox with CORS, the redirect breaks ...
Aruwimi asked 7/8, 2018 at 7:13

4

I try to use Active Storage with Amazon Web Services, instead of Carrierwave and Cloudinary. With Carrierwave I had some features that allow to resize images before uploading trough an UploaderCon...
Princely asked 17/12, 2018 at 8:50

© 2022 - 2024 — McMap. All rights reserved.