[英]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. 我已经将rails从5.1.4更新到5.2并删除了Papaerclip以使用Active Storage。 I'm using digitalocean spaces.
我正在使用digitalocean空间。 In my development env I've setted credentials in storage.yml to save images to digitalocean.
在我的开发环境中,我在storage.yml中设置了凭据,以将图像保存到digitalocean。
I've added aws gem in gemfile. 我在gemfile中添加了aws gem。 I run db:migrate for active storage.
我运行db:migrate进行活动存储。
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. 但是当我要提交带有图片上传html标签的表单时,我收到此错误:无法自动加载常量ActiveStorage :: Blob :: Analyzable。
Anyone can help me? 有人可以帮帮我吗?
I had the same problem and I fixe it creating new project from scratch and error disapears. 我有同样的问题,我修复它从头开始创建新项目和错误消失。 I know that maybe you can't do this and I've look for possible diferences between project with the error and the new one.
我知道也许你不能这样做,我一直在寻找项目与错误和新错误之间的差异。
The only diference I could find is about Rails credentials. 我能找到的唯一区别是关于Rails凭据。 With new projects using Rails 5.2, Rails is creating credentials automatically.
使用Rails 5.2的新项目,Rails会自动创建凭据。 You could check if you have credentials enabled because you will see credentials.yml.enc and master.key in you config folder.
您可以检查是否已启用凭据,因为您将在配置文件夹中看到credentials.yml.enc和master.key。
If you don't have it, try to enable it using this tutorial https://medium.com/cedarcode/rails-5-2-credentials-9b3324851336 如果您没有,请尝试使用本教程启用它https://medium.com/cedarcode/rails-5-2-credentials-9b3324851336
Hope it helps! 希望能帮助到你!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.