graphql-devise / graphql_devise

GraphQL interface on top devise_token_auth
MIT License
200 stars 39 forks source link

When I use mongoid, turn devise_token_auth:install to devise_token_auth:install:mongoid #143

Open lukefan opened 3 years ago

lukefan commented 3 years ago

What is the problem the enhancement will solve?

When I use mongoid and run rails g graphql_devise:install, I got an error, Uninitialized ActiveRecord.

Describe the solution you have in mind

I changed install_generator.rb, from generate 'devise_token_auth:install', "#{user_class} #{mount_path}" to generate 'devise_token_auth:install_mongoid', "#{user_class} #{mount_path}"

it worked. Please check database first, before run.

00dav00 commented 3 years ago

Hey @lukefan , I see what you are saying! If you are interested in creating a PR for this I would say a new boolean argument called mongoid that will determine which DTA generator is executed is the simplest way to go. Otherwise we can take a look as soon as we have some spare time. Let me know if you want to discuss this further.

lukefan commented 3 years ago

There is a simple way, make two install_generator, graphql_devise:install and graphql_devise:install_mongoid, just like devise_token_auth.

00dav00 commented 3 years ago

That solution is in fact the one we would prefer in the long term, that said it will imply some refactor to make sure code is reused in both generators instead of duplicating it.