Skip to content

Commit

Permalink
Added check for rails 5
Browse files Browse the repository at this point in the history
  • Loading branch information
ethangk committed May 17, 2016
1 parent 10863b3 commit e72a591
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/generators/devise_token_auth/install_generator.rb
Expand Up @@ -29,7 +29,9 @@ def create_user_model
else
inclusion = "include DeviseTokenAuth::Concerns::User"
unless parse_file_for_line(fname, inclusion)
inject_into_file fname, after: "class #{user_class} < ActiveRecord::Base\n" do <<-'RUBY'

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,
:recoverable, :rememberable, :trackable, :validatable,
Expand Down

0 comments on commit e72a591

Please sign in to comment.