ruby-on-rails - 无法加载“pgcrypto”Active Record 适配器
问题描述
我需要在 postgresql 数据库中存储一些机密数据。为了做到这一点,我使用了 pgcrypto gem。我将此 gem 添加到 Gemfile 中,并将 database.yml 中的适配器名称更改为 pgcrypto。并在捆绑安装后执行以下命令。rails generate pgcrypto:install
. 但我收到以下错误Could not load the 'pgcrypto' Active Record adapter. Ensure that the adapter is spelled correctly in config/database.yml and that you've added the necessary adapter gem to your Gemfile. (LoadError)
帮助我解决这个问题。Ruby-2.6.0 和 rails 5.2.4.2
解决方案
我查看了 gem“pgcrypto”,我不确定它是否执行在 Postgres 数据库中安装扩展所需的“创建扩展”行。您可以尝试在您的数据库中运行它吗?开发和测试?
CREATE EXTENSION IF NOT EXISTS pgcrypto;
推荐阅读
- ant - 如何从 Ant 构建创建的 .zip 中解决 7-zip 的“警告:标题错误”?
- c# - 在 .NET 应用程序中注入配置对象
- javascript - 即使我为它设置了一个值,如何修复这个未定义的错误?
- xdebug - 使用 PHPStorm + Xdebug 调试远程(DigitalOcean)Lando 站点(drupal8 配方)
- css - 如何将文本对齐到水平居中以及页面底部?
- c++ - 在 Visual Studio 中编译但不在 clion 中的简单程序
- .net-core - 从 .Net Framework 引用 .NetCore 项目
- rust - 使用 From trait 触发将 u8 转换为枚举
- excel - 如何计算两个时间戳之间的小时数,而不应考虑某些时间范围
- logging - 如何关联 Cloud Run 中的请求日志?