ruby-on-rails - Heroku + 公寓:Apartment::FileNotFound:/app/db/schema.rb 尚不存在

标签 ruby-on-rails ruby postgresql heroku apartment-gem

我正在使用 heroku 和 Rails 构建一个 SAAS 平台。为此,我使用 apartment gem 管理租户。

在我的本地开发中这没有问题,但是当我尝试使用到 heroku 时出现下一个错误:

/app/db/schema.rb doesn't exist yet

运行下一个命令时会产生此错误:

Apartment::Tenant.create('foo_schema')

我将编写使用子域 + 单元配置设置 heroku 的主要步骤。

  1. 设置一个通配符域(这个配置没问题)。
  2. 我在生产开发中使用postgresql
  3. apartment.rb 文件设置到 initializer 目录中。

我的apartment.rb

require 'apartment/elevators/subdomain'

Apartment.configure do |config|
  config.excluded_models = %w{Account Company App Acteco Country Currency Price}
  config.tenant_names = lambda { Company.pluck(:slug) }
  config.use_schemas = true
end

Rails.application.config.middleware.insert_before Warden::Manager, Apartment::Elevators::Subdomain

有什么建议吗?

最佳答案

db/schema.rb 添加到您的存储库并再次推送?

关于ruby-on-rails - Heroku + 公寓:Apartment::FileNotFound:/app/db/schema.rb 尚不存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52694250/

相关文章:

postgresql - 执行: "sqlboiler": executable file not found in $PATH

ruby-on-rails - 如何从 RSpec 中的 Controller 调用创建操作

ruby-on-rails - rails 3/Form 无模型 : How do I create a form that is not tied to a model?

ruby-on-rails - Rails调试 Assets :precompile: how to identify offending file(s)?

ruby-on-rails - ruby rails : adding columns to existing database

ruby - 如何使用 Nokogiri 拆分 HTML 文档?

postgresql - 创建 : could not connect to database template1: FATAL: password authentication failed for user

sql - 将时间转换为 100/10 秒分辨率

ruby-on-rails - Rails & Mongoid 独特的结果

Ruby变量(Array)赋值错误(带push方法)