Sha256: 762807e2f1dd814d44e6f29e6a1a487870fe34115bf3505b4870ca773a3445e2
Contents?: true
Size: 1.06 KB
Versions: 3
Compression:
Stored size: 1.06 KB
Contents
require "multiverse/generators" require "multiverse/patches" require "multiverse/railtie" require "multiverse/version" module Multiverse class << self attr_writer :db def db @db ||= ENV["DB"] end def db_dir db_dir = db ? "db/#{db}" : "db" abort "Unknown DB: #{db}" if db && !Dir.exist?(db_dir) db_dir end def parent_class_name db ? "#{db.camelize}Record" : "ApplicationRecord" end def record_class record_class = parent_class_name.safe_constantize abort "Missing model: #{parent_class_name}" unless record_class record_class end def migrate_path "#{db_dir}/migrate" end def env(environment) db ? "#{db}_#{environment}" : environment end end end ActiveSupport.on_load(:active_record) do ActiveRecord::Tasks::DatabaseTasks.singleton_class.prepend Multiverse::DatabaseTasks ActiveRecord::Migration.prepend Multiverse::Migration ActiveRecord::Migrator.prepend Multiverse::Migrator ActiveRecord::SchemaDumper.singleton_class.prepend Multiverse::SchemaDumper end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
multiverse-0.1.0 | lib/multiverse.rb |
multiverse-0.0.3 | lib/multiverse.rb |
multiverse-0.0.2 | lib/multiverse.rb |