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 #4953

Closed
wants to merge 6 commits 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

This comment has been minimized.

@awesome
Copy link
Contributor Author

awesome commented Jan 22, 2021

@p-mongo do you know about this git error cloning the submodule for testing? The submodule test-apps works, but https://github.com/mongodb-labs/mongo-ruby-spec-shared does not. Maybe a GitHub permissions setting on spec-shared?

$ git clone --recurse-submodules https://github.com/mongodb/mongoid.git mongoid_upstream
[...]
Failed to clone 'spec/shared' a second time, aborting

@p-mongo ok, figured it out and fixed #4954 . Submodules were using both ssh and https. I'm lazy on a new laptop without ssh key pasted into GitHub account--only using oauth key via desktop client… Submitted PR with all submodules using https so this issue doesn't happen to future lazy contributors.

@awesome
Copy link
Contributor Author

awesome commented Jan 26, 2021

@p-mongo Hi there! I added tests to app_spec.rb for ~> Rails 6.1 and WFM. See attached: terminal output for running specific test $ APP_TESTS=1 rspec spec/integration/app_spec.rb:90. Please feel free to update PR as you see fit or LMK changes you want. Thanks!

Terminal Saved Output6-success.txt

@Alexander-L-G Alexander-L-G added the tracked-in-jira Ticket filed in Mongo's Jira system label Feb 1, 2021
@midnight-wonderer
Copy link

Hi @awesome,
I just send you a patch to preserve the functionality for the old versions of Rails.
awesome#1

I guessed their automated test would break otherwise.

@p-mongo
Copy link
Contributor

p-mongo commented Mar 4, 2021

This was merged as #4960, thank you.

@p-mongo p-mongo closed this Mar 4, 2021
@awesome awesome deleted the MONGOID-5042_ branch April 5, 2021 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tracked-in-jira Ticket filed in Mongo's Jira system
Projects
None yet
4 participants