Я искал высоко и низко для ответа на этот вопрос, но я скоро подхожу.Ошибка схемы ретрансляции Rails - одна из следующих схем (-ов) неверна: «test» «public»
Я пытаюсь создать приложение с несколькими арендаторами с Rails 4, Devise и Apartment на основе схем Postgres. Для моего локального сервера Postgres я решил использовать PostgresApp. Я следовал за Go Rails multi-tenant guide, и у меня была эта настройка (один пользователь на одного арендатора), работающий, когда эта ошибка начала появляться. Это началось вчера, когда я пытался установить Invitable для Devise, и я не могу найти никаких подсказок относительно того, что происходит.
Вот как я получаю конкретную ошибку:
michael$ rake environment db:drop
michael$ rake db:create
michael$ rake db:migrate
== 20160908204559 DeviseCreateUsers: migrating ================================
-- create_table(:users)
-> 0.0091s
-- add_index(:users, :email, {:unique=>true})
-> 0.0032s
-- add_index(:users, :reset_password_token, {:unique=>true})
-> 0.0031s
-- add_index(:users, :confirmation_token, {:unique=>true})
-> 0.0032s
-- add_index(:users, :unlock_token, {:unique=>true})
-> 0.0029s
== 20160908204559 DeviseCreateUsers: migrated (0.0219s) =======================
[WARNING] - The list of tenants to migrate appears to be empty. This could mean a few things:
1. You may not have created any, in which case you can ignore this message
2. You've run `apartment:migrate` directly without loading the Rails environment
* `apartment:migrate` is now deprecated. Tenants will automatically be migrated with `db:migrate`
Note that your tenants currently haven't been migrated. You'll need to run `db:migrate` to rectify this.
michael$ rake db:seed
Seeding test tenant
One of the following schema(s) is invalid: "test" "public"
При посещении сайта локально, это приводит к Rails метания:
Apartment::TenantNotFound
One of the following schema(s) is invalid: "www" "public"
Вот мой apartment.rb инициализатор:
require 'apartment/elevators/subdomain'
Apartment.configure do |config|
config.excluded_models = %w{ User }
config.tenant_names = lambda { User.pluck :subdomain }
config.use_schemas = true
end
Rails.application.config.middleware.use 'Apartment::Elevators::Subdomain'
Это файл миграции моих пользователей:
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
t.string :confirmation_token
t.datetime :confirmed_at
t.datetime :confirmation_sent_at
t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
t.string :unlock_token # Only if unlock strategy is :email or :both
t.datetime :locked_at
## Invitable
#t.string :invitation_token
#t.datetime :invitation_created_at
#t.datetime :invitation_sent_at
#t.datetime :invitation_accepted_at
#t.integer :invitation_limit
#t.integer :invited_by_id
#t.string :invited_by_type
## User Info
t.string :first_name
t.string :last_name
t.string :subdomain
t.string :role
t.timestamps
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
add_index :users, :confirmation_token, unique: true
add_index :users, :unlock_token, unique: true
#add_index :users, :invitation_token, unique: true
end
end
Я также попал в локальную базу данных Postrgres по командной строке. Падение работает, база данных создания работает. Я могу предоставить их, если это необходимо. Моя догадка в данный момент говорит мне, что что-то не так с тем, как Rails разговаривает с PostgresApp или как я делаю миграции. Но, возможно, кто-то с большим опытом может указать на то, что я пропустил.
Так что мои вопросы - вот что я делаю, чтобы вызвать это? Как я могу это исправить? И как я могу узнать больше о том, что не так?