lib/multiverse.rb in multiverse-0.1.2 vs lib/multiverse.rb in multiverse-0.2.0
- old
+ new
@@ -1,7 +1,6 @@
require "multiverse/generators"
-require "multiverse/patches"
require "multiverse/railtie"
require "multiverse/version"
module Multiverse
class << self
@@ -16,34 +15,19 @@
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
if db
- record_class = parent_class_name.safe_constantize
- abort "Missing model: #{parent_class_name}" unless record_class
- record_class
+ "#{db.camelize}Record"
+ elsif ActiveRecord::VERSION::MAJOR >= 5
+ "ApplicationRecord"
else
- ActiveRecord::Base
+ "ActiveRecord::Base"
end
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