Sha256: 8d7912044bcbab0c31ac0682499afa77eafd57da0b144b7258149814a4d61760
Contents?: true
Size: 1.66 KB
Versions: 3
Compression:
Stored size: 1.66 KB
Contents
require 'apartment/railtie' module Apartment class << self attr_accessor :use_postgres_schemas, :seed_after_create attr_writer :database_names, :excluded_models # configure apartment with available options def configure yield self if block_given? Database.init end # Be careful not to use `return` here so both Proc and lambda can be used without breaking def database_names if @database_names.respond_to?(:call) @database_names.call else @database_names end end # Default to none def excluded_models @excluded_models || [] end end autoload :Database, 'apartment/database' autoload :Migrator, 'apartment/migrator' module Adapters autoload :AbstractAdapter, 'apartment/adapters/abstract_adapter' # Specific adapters will be loaded dynamically based on adapter in config end module Elevators autoload :Subdomain, 'apartment/elevators/subdomain' end module Delayed module Job autoload :Hooks, 'apartment/delayed_job/hooks' end end # Exceptions class ApartmentError < StandardError; end # Raised when apartment cannot find the adapter specified in <tt>config/database.yml</tt> class AdapterNotFound < ApartmentError; end # Raised when database cannot find the specified schema class SchemaNotFound < ApartmentError; end # Raised when trying to create a schema that already exists class SchemaExists < ApartmentError; end end Apartment.configure do |config| config.excluded_models = [] config.use_postgres_schemas = true config.database_names = [] config.seed_after_create = false end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
apartment-0.9.2 | lib/apartment.rb |
apartment-0.9.1 | lib/apartment.rb |
apartment-0.9.0 | lib/apartment.rb |