【问题标题】:Rails looking for MySQL instead of Postgres after MYSql installationRails 在 MYSql 安装后寻找 MySQL 而不是 Postgres
【发布时间】:2019-06-28 03:50:40
【问题描述】:

我在使用带有 Rails 的 postgresql。我昨天为一些附带项目安装了 mysql,今天当我运行 rails c 时,它给出了以下错误,

home/rahul/.rvm/gems/ruby-2.6.0/gems/arel-9.0.0/lib/arel/visitors.rb:7:in require': cannot load such file -- arel/visitors/mysql (LoadError)

我的 Rails 项目中没有任何更改。我的 rails 应用程序仍然使用 Postgres

database.yml

default: &default
  adapter: postgresql
  pool: 50
  timeout: 5000
  # host: localhost
  encoding: utf8
development:
  <<: *default
  database: enquiry_dispatch_development
test:
  <<: *default
  database: enquiry_dispatch_test

【问题讨论】:

  • 您的config/database.yml 看起来如何(没有密码!)?您是否在 Gemfile 中将 pg 替换为 mysql2 并运行 bundle install
  • @spickermann,我的 database.yml 有问题。不,我的 Gemfile 包含 pg 而不是 mysql2
  • 如果某处写了需要'mysql'或'mysql2',请检查应用程序
  • 没有。正如我之前所说,我的 rails 应用程序从一开始就使用 postgresql,并且没有任何更改。

标签: mysql ruby-on-rails ruby postgresql activerecord


【解决方案1】:

您好,只需删除 gem 'arel'

gem uninstall arel

然后运行

bundle install

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-15
    • 2020-07-22
    • 1970-01-01
    • 2012-08-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多