lib/rrj/tools/bin/model.rb in ruby_rabbitmq_janus-2.6.0.pre.247 vs lib/rrj/tools/bin/model.rb in ruby_rabbitmq_janus-2.6.0.pre.258
- old
+ new
@@ -1,7 +1,12 @@
# frozen_string_literal: true
# Select ORM between Mongoid and ActiveRecord
-require ORM
-Mongoid.load!(File.join(Dir.pwd, 'config', 'mongoid.yml'), ENVIRONMENT) \
- if defined?(Mongoid)
+require 'rrj/errors/error'
+require RubyRabbitmqJanus::Tools::Config.instance.orm
+
+# For mongoid gem
+if RubyRabbitmqJanus::Tools::Config.instance.orm.eql?('mongoid')
+ Mongoid.load!(File.join(Dir.pwd, 'config', 'mongoid.yml'),
+ RubyRabbitmqJanus::Tools::Config.instance.env.to_sym)
+end