From a589fee7cb49d63b6d104db784b9d88d789d8c2f Mon Sep 17 00:00:00 2001 From: Fabian Schwahn Date: Mon, 19 Feb 2024 19:52:03 +0100 Subject: [PATCH] Fix generator for older (pre-7) rails version --- lib/generators/shortener/shortener_generator.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/generators/shortener/shortener_generator.rb b/lib/generators/shortener/shortener_generator.rb index bab8377..1de9f5a 100644 --- a/lib/generators/shortener/shortener_generator.rb +++ b/lib/generators/shortener/shortener_generator.rb @@ -9,7 +9,7 @@ def self.source_root end def self.next_migration_number(dirname) - if ActiveRecord.timestamped_migrations + if ActiveRecord.respond_to?(:timestamped_migrations) ? ActiveRecord.timestamped_migrations : ActiveRecord::Base.timestamped_migrations Time.new.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1)