lib/rails/generators/mongoid/config/config_generator.rb in mongoid-7.0.13 vs lib/rails/generators/mongoid/config/config_generator.rb in mongoid-7.1.0.rc0

- old
+ new

@@ -1,6 +1,8 @@ +# frozen_string_literal: true # encoding: utf-8 + require 'rails/generators/mongoid_generator' module Mongoid module Generators class ConfigGenerator < Rails::Generators::Base @@ -11,17 +13,10 @@ def self.source_root @_mongoid_source_root ||= File.expand_path("../templates", __FILE__) end def app_name - app_cls = Rails.application.class - parent = begin - # Rails 6.1+ - app_cls.module_parent_name - rescue NoMethodError - app_cls.parent.to_s - end - parent.underscore + Rails::Application.subclasses.first.parent.to_s.underscore end def create_config_file template 'mongoid.yml', File.join('config', "mongoid.yml") end