我试图连接到脚本中的不同数据库,但我得到了ActiveRecord::ConnectionNotEstablished: No connection pool for 'ActiveRecord::Baseconnects_to shards: { writing: :primary, reading: :onshore }我试图通过在下面的循环中连接到这三个不同的数据库来进行一些处理
ActiveRecord::Base.connected_to(role: :reading, shard: :main) d
# and re-open them in the resque worker parent ActiveRecord/home/ubuntu/.rvm/gems/ruby-2.0.0-p451@notification-engine/gems/activerecord-4.1.7/lib/active_record/ActiveRecord::Base.co
在开发Rake任务中,我们需要运行一些没有Rails的ActiveRecord迁移。method 'up' for ActiveRecord::Migrator:Class。我尝试过查看ActiveRecord的源代码,尝试了许多不同的方法,但是没有成功地运行迁移。使用ActiveRecord::Migration.up什么也不做,可能只是基于该方法的returns。使用ActiveRecord::Migration.migrate(:up)提供输出:
==