Unable to autoload constant ActiveStorage::Blob::Analyzable Error with Rails 5.2, AWS S3, and ActiveStorage
Fix for this is to run the following in the order.
rails active_storage:install
rake db:migrate
And if you get the error, Failed to save the new associated image_attachment, it's mostly because of has_one
association. To fix it, you should do the following
@blog.image.purge
@blog.image.attach(params[:image])
I ran into this after having done:
rails active_storage:install
rake db:migrate
the issue was that I didn't have the correct "config/master.key" file for the current "config/credentials.yml.enc" file.
I know that this already has an answer, but I stumbled across this same situation where re-installing active_storage and migrating my database didn't work.
I stumbled across this forum: https://groups.google.com/forum/#!topic/rubyonrails-talk/RaFBG6wi2K0 and found an answer that pushed me in the right direction.
My problem was that my storage.yml file was incorrect, and wasn't even valid yml. Try running your storage.yml file through an online yml validator: http://www.yamllint.com/
It failed to validate, and I was able to figure out my problem from there.