From 3f8116e00866e16609c6ca1fe5fef174e1184ded Mon Sep 17 00:00:00 2001 From: Sam Weerasinghe Date: Mon, 24 Sep 2018 19:40:22 -0700 Subject: [PATCH] Issue #4941 , handle error 'Please specify the Rails release the migration was written for' --- lib/generators/active_record/devise_generator.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/generators/active_record/devise_generator.rb b/lib/generators/active_record/devise_generator.rb index 039ef75ec2..7319c47f21 100644 --- a/lib/generators/active_record/devise_generator.rb +++ b/lib/generators/active_record/devise_generator.rb @@ -82,8 +82,8 @@ def inet? postgresql? end - def rails5? - Rails.version.start_with? '5' + def rails5_and_up? + Rails::VERSION::MAJOR >= 5 end def postgresql? @@ -92,13 +92,13 @@ def postgresql? end def migration_version - if rails5? + if rails5_and_up? "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]" end end def primary_key_type - primary_key_string if rails5? + primary_key_string if rails5_and_up? end def primary_key_string