Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MONGOID-5042 rails g mongoid:config is not working on Rails 6.1 #4952

Closed
wants to merge 1 commit into from

Conversation

awesome
Copy link
Contributor

@awesome awesome commented Jan 22, 2021

# lib/rails/generators/mongoid/config/config_generator.rb
module Mongoid
  module Generators
    class ConfigGenerator < Rails::Generators::Base

      def app_name
        #
        # 1A)
        # https://api.rubyonrails.org/classes/Rails/Generators/NamedBase.html#method-i-application_name
        #require 'rails/generators/actions'
        #require 'rails/generators/named_base'
        #Rails::Generators::NamedBase.new([""]).send(:application_name)
        #
        # --OR--
        #
        # 1B)
        #Rails.application.class.name.split("::").first.underscore
        # 
        # 2)
        # https://api.rubyonrails.org/classes/Module.html#method-i-module_parent_name
        Rails.application.class.module_parent_name.underscore
      end

Ticket: https://jira.mongodb.org/browse/MONGOID-5042
Alternative PR: #4941

@awesome awesome changed the base branch from master to 7.2-stable January 22, 2021 08:58
@awesome awesome changed the title Fix: rails g mongoid:config is not working on Rails 6.1; Jira: 5042 MONGOID-5042 rails g mongoid:config is not working on Rails 6.1 Jan 22, 2021
@awesome
Copy link
Contributor Author

awesome commented Jan 22, 2021

Do you want PRs submitted to master? I branched from 7.2-stable…

@p-mongo
Copy link
Contributor

p-mongo commented Jan 22, 2021

Hi @awesome , thank you for the PR.

In order for this or the other PR to be merged we need appropriate test coverage. I expect the app-tests mechanism (https://github.com/mongodb/mongoid/blob/master/spec/integration/app_spec.rb) can be extended to create a new application and run the generator in it. If you'd like to tackle that please feel free, otherwise it's on my list to do as soon as time permits.

@p-mongo
Copy link
Contributor

p-mongo commented Jan 22, 2021

The PR ultimately will need to be against master, yes.

@awesome
Copy link
Contributor Author

awesome commented Jan 22, 2021

@p-mongo thanks for the replies. Going to write tests and submit via #4953

@awesome awesome closed this Jan 22, 2021
@awesome awesome deleted the MONGOID-5042 branch January 22, 2021 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants