最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Rails 7.2.2.1 ActiveRecord::AdapterNotSpecified - database configuration does not specify adapter: - Stack Overflow

programmeradmin3浏览0评论

When I upgrade rails from 5.1.6 to 7.2 I have problem with database connection.

ActiveRecord::AdapterNotSpecified database configuration does not specify adapter

This is my database.yml

default: &default
  adapter: mysql2
  encoding: utf8mb4
  pool: 10
  username: root
  socket: /tmp/mysql.sock
  collation: utf8mb4_unicode_ci
  database: my_db
  host: localhost
  reconnect: true
  wait_timeout: 300
  
development:
  primary:
    <<: *default
  primary_replica:
    <<: *default
    replica: true

my application_record.rb

  connects_to database: {writing: :primary, reading: :primary_replica}

But when I connect to rails server it returns the above error. Why is this? It still seems to get connections from the development key even though I cleared the cache,..

发布评论

评论列表(0)

  1. 暂无评论