Rails 5.2 Active storage Unable to autoload constant ActiveStorage::Blob::Analyzable

I've updated rails from 5.1.4 to 5.2 and remove Papaerclip to use Active Storage. I'm using digitalocean spaces. In my development env I've setted credentials in storage.yml to save images to digitalocean.

I've added aws gem in gemfile. I run db:migrate for active storage.

But when I'm going to submit the form with an image upload html tag, i receive this error: Unable to autoload constant ActiveStorage::Blob::Analyzable.

Anyone can help me?

Thanks in advance.

Hi Mattia,

Did you install MiniMagic Gem

http://api.rubyonrails.org/classes/ActiveStorage/Analyzer/ImageAnalyzer.html

Hi Frantz

I have an issue similar to Mattia’s, so I tried your suggestion.
Thanks for the advice, although installing mini_magick (v4.8) didn’t solve the issue for me.

For context, I’m on ruby 2.4.2 / rails 5.2 / active storage 5.2

I followed this tutorial for the active storage setup

http://edgeguides.rubyonrails.org/active_storage_overview.html

I tried to upload via a form and to directly attach a local file to an existing object in the rails console.

Strangely enough I have a first NoMethodError: undefined method []’ for nil:NilClass` when trying the first time,

and the Unable to autoload constant ActiveStorage::Blob::Analyzable error the second time.

The full session log if it helps:

Replying to myself in case someone hits the same issue.

First thanks Frank for the pointers you sent me. I am new to rails so it was very helpful to debug from a clean state.

I got to solve it, the main issue for me was a parsing error in the ‘storage.yml’ file. The storage engine was chocking on it, even if the file was passing several linters fine.
I kept the original file for later review, but rewriting it from scratch solved the issue.

Best

I am glad you solved it.

Hi Skt Hg,

Could you tell me, step by step, how you solved this problem?
I’m new to rails too.

Thanks, Mattia.

Thank you! I was having a similar problem and it was the storage.yml file having issues. This post helped point me in that direction and track down the problem. (My :amazon section of the storage.yml wasn’t set up correctly, and the storage.yml wasn’t valid .yml).

Best wishes,

Kody