Class: Booth::Credential
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Booth::Credential
- Defined in:
- lib/booth/credential.rb
Overview
Public read-only Model you can call in your Rails app.
We expose read-only Credentials without associations for DB querying and joins that the Rails developer might like to perform. E.g. Customer.joins(:credential) This is the only exception, other records will be queried through Adminland#some_method
You can join this in your models the usual way:
class Customer < ApplicationRecord
belongs_to :credential, class_name: '::Booth::Credential'
end
You can even subclass it:
class Credential < Booth::Credential
has_one :customer, dependent: :nullify
end
So that you can run join queries:
Credential.where(domain: 'example.com', scope: :community).where.missing(:customer)
You may also reference this table in migrations:
add_foreign_key :customers, :booth_credentials, column: :credential_id, on_delete: :nullify