Class: Mongoid::Generators::ConfigGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Defined in:
build/mongoid-7.3/lib/rails/generators/mongoid/config/config_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.source_rootObject



13
14
15
# File 'build/mongoid-7.3/lib/rails/generators/mongoid/config/config_generator.rb', line 13

def self.source_root
  @_mongoid_source_root ||= File.expand_path("../templates", __FILE__)
end

Instance Method Details

#app_nameObject



17
18
19
20
21
22
23
24
25
26
# File 'build/mongoid-7.3/lib/rails/generators/mongoid/config/config_generator.rb', line 17

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
end

#create_config_fileObject



28
29
30
# File 'build/mongoid-7.3/lib/rails/generators/mongoid/config/config_generator.rb', line 28

def create_config_file
  template 'mongoid.yml', File.join('config', "mongoid.yml")
end