CodexBloom - Programming Q&A Platform

How to implement guide with active storage not processing images in rails 7.1 after upgrade from 6.1

πŸ‘€ Views: 0 πŸ’¬ Answers: 1 πŸ“… Created: 2025-06-18
ruby-on-rails activestorage image-processing Ruby

I'm learning this framework and After upgrading from Rails 6.1 to Rails 7.1, I'm experiencing issues with Active Storage where uploaded images are not being processed correctly... I have a model `User` that has an attached image via Active Storage, but after the upgrade, the images are not being processed and remain in the 'pending' state. I confirmed that the necessary gems are in my Gemfile: ```ruby gem 'image_processing', '~> 1.2' gem 'mini_magick' ``` I am using the following code to attach the image in my `UsersController`: ```ruby class UsersController < ApplicationController def create @user = User.new(user_params) if @user.save # Do something after save else render :new end end private def user_params params.require(:user).permit(:name, :email, :image) end end ``` In my User model, I've included the attachment: ```ruby class User < ApplicationRecord has_one_attached :image end ``` Despite having the necessary configurations, the image is not processed, and I receive this behavior in the logs: ``` ActiveStorage::FileNotFoundError: The file does not exist ``` I have tried running `rails active_storage:install` again, but that didn't help. I've also checked the storage service in `config/storage.yml`, and it looks correct. Here’s what it contains: ```yaml local: service: Disk root: <%= Rails.root.join("storage") %> ``` I double-checked the file permissions in the `storage` directory and they seem fine. Is there something I've overlooked in the upgrade process or any additional configurations needed for Active Storage in Rails 7.1? Any insights would be greatly appreciated! Thanks in advance! Is there a simpler solution I'm overlooking?