Skip to content

Commit

Permalink
Fix parent class name generator for rails 6 (lynndylanhurley#1414)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaicolBen authored Jun 20, 2020
1 parent 449a0be commit 849c244
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/generators/devise_token_auth/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def create_user_model
inclusion = 'include DeviseTokenAuth::Concerns::User'
unless parse_file_for_line(fname, inclusion)

active_record_needle = (Rails::VERSION::MAJOR == 5) ? 'ApplicationRecord' : 'ActiveRecord::Base'
active_record_needle = (Rails::VERSION::MAJOR >= 5) ? 'ApplicationRecord' : 'ActiveRecord::Base'
inject_into_file fname, after: "class #{user_class} < #{active_record_needle}\n" do <<-'RUBY'
# Include default devise modules.
devise :database_authenticatable, :registerable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class InstallGeneratorTest < Rails::Generators::TestCase
case DEVISE_TOKEN_AUTH_ORM
when :active_record
# account for rails version 5
active_record_needle = (Rails::VERSION::MAJOR == 5) ? 'ApplicationRecord' : 'ActiveRecord::Base'
active_record_needle = (Rails::VERSION::MAJOR >= 5) ? 'ApplicationRecord' : 'ActiveRecord::Base'

@f = File.open(@fname, 'w') do |f|
f.write <<-RUBY
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class InstallGeneratorTest < Rails::Generators::TestCase
case DEVISE_TOKEN_AUTH_ORM
when :active_record
# account for rails version 5
active_record_needle = (Rails::VERSION::MAJOR == 5) ? 'ApplicationRecord' : 'ActiveRecord::Base'
active_record_needle = (Rails::VERSION::MAJOR >= 5) ? 'ApplicationRecord' : 'ActiveRecord::Base'

@f = File.open(@fname, 'w') do |f|
f.write <<-RUBY
Expand Down

0 comments on commit 849c244

Please sign in to comment.