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

- old
+ new

@@ -11,10 +11,17 @@ def self.source_root @_mongoid_source_root ||= File.expand_path("../templates", __FILE__) end def app_name - Rails::Application.subclasses.first.parent.to_s.underscore + 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 end def create_config_file template 'mongoid.yml', File.join('config', "mongoid.yml") end