From e9385d441d35982bdce62d427c8e97b3eec4c5cf Mon Sep 17 00:00:00 2001 From: Justin Date: Mon, 15 Aug 2016 11:01:56 +1200 Subject: [PATCH] Fix for issue #698 Update migration template to include version of Rails to silence a deprecation warning. --- .../templates/devise_token_auth_create_users.rb.erb | 2 +- .../generators/devise_token_auth/install_generator_test.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) 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