3

是否可以在 Rails 中使用带有多个数据库的活动存储?我有以下型号:

class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true
end


class OtherRecord < ActiveRecord::Base
  self.abstract_class = true

  connects_to database: { writing: :other_db }
end


class SomeModel < OtherRecord
  has_many_attached :files
end

我添加了范围为辅助数据库的活动存储迁移,并在那里创建了必要的表,但 ActiveStorage 似乎在主数据库中查找表。有没有人解决这个问题?

4

0 回答 0