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

Generator is not compatible with Rails 6 #1400

Closed
btrewern opened this issue May 5, 2020 · 2 comments · Fixed by #1414
Closed

Generator is not compatible with Rails 6 #1400

btrewern opened this issue May 5, 2020 · 2 comments · Fixed by #1414

Comments

@btrewern
Copy link

btrewern commented May 5, 2020

Using Rails 6.0.2.2, devise 4.7.1 and devise_token_auth 1.1.3.

On a new app when I run the generator
$ rails g devise_token_auth:install User auth
I get
File unchanged! The supplied flag value not found! app/models/user.rb

It looks as if the generator is hard coded to only look for class User < ApplicationRecord if you are using Rails 5.

from lib/generators/devise_token_auth/install_generator.rb line 29 you have:
active_record_needle = (Rails::VERSION::MAJOR == 5) ? 'ApplicationRecord' : 'ActiveRecord::Base'

I'm guessing something like:
active_record_needle = ([5,6].include?(Rails::VERSION::MAJOR)) ? 'ApplicationRecord' : 'ActiveRecord::Base'
would fix it. Should I create a pull request or is there more to this?

@ughstudios
Copy link

It does not work for rails 6, I can confirm

@ughstudios
Copy link

@btrewern looks like you also can't use it if your routes.rb file also has: devise_for :users you can see it in the issue I made here: #1409

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants