diff --git a/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb b/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb index 7179726aa..a6651dbfe 100644 --- a/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb +++ b/lib/generators/devise_token_auth/templates/devise_token_auth_create_users.rb.erb @@ -1,4 +1,4 @@ -class DeviseTokenAuthCreate<%= user_class.pluralize %> < ActiveRecord::Migration +class DeviseTokenAuthCreate<%= user_class.pluralize %> < ActiveRecord::Migration<%= '[' << Rails::VERSION::STRING[0..2] << ']'%> def change create_table(:<%= user_class.pluralize.underscore %>) do |t| ## Required diff --git a/test/lib/generators/devise_token_auth/install_generator_test.rb b/test/lib/generators/devise_token_auth/install_generator_test.rb index 2cd2e1f48..67e3193d1 100644 --- a/test/lib/generators/devise_token_auth/install_generator_test.rb +++ b/test/lib/generators/devise_token_auth/install_generator_test.rb @@ -28,6 +28,10 @@ class InstallGeneratorTest < Rails::Generators::TestCase assert_migration 'db/migrate/devise_token_auth_create_users.rb' end + test 'migration file contains rails version' do + assert_migration 'db/migrate/devise_token_auth_create_users.rb', /4.2/ + end + test 'subsequent runs raise no errors' do run_generator end