From 6720020e7f23d0326235df54c348d0758ee16a15 Mon Sep 17 00:00:00 2001 From: Guillermo Guerrero Date: Fri, 12 May 2023 17:38:20 +0200 Subject: [PATCH] require activerecord. --- lib/annotate/annotate_routes/header_generator.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/annotate/annotate_routes/header_generator.rb b/lib/annotate/annotate_routes/header_generator.rb index 069c3a68..94665151 100644 --- a/lib/annotate/annotate_routes/header_generator.rb +++ b/lib/annotate/annotate_routes/header_generator.rb @@ -1,3 +1,4 @@ +require 'active_record' require_relative './helpers' module AnnotateRoutes @@ -16,7 +17,7 @@ def generate(options = {}) private def routes_map(options) - command = Rails.version.first.to_i > 5 ? `rails routes` : `rake routes` + command = ActiveRecord.version.to_s.first.to_i > 5 ? `rails routes` : `rake routes` result = command.chomp("\n").split(/\n/, -1) # In old versions of Rake, the first line of output was the cwd. Not so