Class: Mongoid::Generators::ConfigGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Mongoid::Generators::ConfigGenerator
- Defined in:
- build/mongoid-8.1/lib/rails/generators/mongoid/config/config_generator.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.source_root ⇒ Object
12 13 14 |
# File 'build/mongoid-8.1/lib/rails/generators/mongoid/config/config_generator.rb', line 12 def self.source_root @_mongoid_source_root ||= File.("../templates", __FILE__) end |
Instance Method Details
#app_name ⇒ Object
16 17 18 19 20 21 22 23 24 25 |
# File 'build/mongoid-8.1/lib/rails/generators/mongoid/config/config_generator.rb', line 16 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_file ⇒ Object
27 28 29 |
# File 'build/mongoid-8.1/lib/rails/generators/mongoid/config/config_generator.rb', line 27 def create_config_file template 'mongoid.yml', File.join('config', "mongoid.yml") end |