Unable to autoload constant ActiveStorage::Blob::Analyzable Error with Rails 5.2, AWS S3, and ActiveStorage

半城伤御伤魂 提交于 2019-12-06 03:10:02

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 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.

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!