![](/img/trans.png)
[英]Rails + ActiveStorage problem when starting server = undefined method `has_one_attached'
[英]Error `method_missing': undefined method `has_one_attached' when push heroku
我试图将我的Ruby应用程序第一次移至Heroku,首先我将Ruby版本更新为2.4.1,我也将开发中的sqlite3移至:
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'sqlite3','~> 1.3.13'
end
现在,我可以推送我的应用程序了,该应用程序无法启动,并且在运行heroku run rails console时出现以下错误“ method_missing”:#(NoMethodError)的未定义方法“ has_one_attached”。 有人可以帮我解决这个问题吗?
由于在Heroku上的生产环境中未配置数据库,因此出现此错误。 未配置数据库的原因是因为Heroku 不支持sqlite3 。
您需要更改数据库以将postgresql用于生产,然后再次将其推送到heroku远程服务器。
有关如何执行此操作的说明,请参见此处 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.