From 739d40af842fda0f9c3ee86a6b072d044ce41f9b Mon Sep 17 00:00:00 2001 From: Nikolay Markov Date: Fri, 17 Jul 2020 00:08:53 +0300 Subject: [PATCH] Speed up i18n-code --- lib/aasm/localizer.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/aasm/localizer.rb b/lib/aasm/localizer.rb index ec2ab44..dc19fa8 100644 --- a/lib/aasm/localizer.rb +++ b/lib/aasm/localizer.rb @@ -46,8 +46,10 @@ module AASM end def ancestors_list(klass) + has_active_record_base = defined?(::ActiveRecord::Base) klass.ancestors.select do |ancestor| - ancestor.respond_to?(:model_name) unless ancestor.name == 'ActiveRecord::Base' + not_active_record_base = has_active_record_base ? (ancestor != ::ActiveRecord::Base) : true + ancestor.respond_to?(:model_name) && not_active_record_base end end end