lib/thinking_sphinx/railtie.rb in thinking-sphinx-5.3.0 vs lib/thinking_sphinx/railtie.rb in thinking-sphinx-5.4.0

- old
+ new

@@ -12,12 +12,11 @@ initializer 'thinking_sphinx.initialisation' do ActiveSupport.on_load(:active_record) do require 'thinking_sphinx/active_record' end - if ActiveSupport::VERSION::MAJOR > 5 && - Rails.application.config.autoloader == :zeitwerk + if zeitwerk? ActiveSupport::Dependencies.autoload_paths.delete( Rails.root.join("app", "indices").to_s ) end @@ -26,7 +25,14 @@ Rails.application.config.eager_load_paths.freeze end rake_tasks do load File.expand_path('../tasks.rb', __FILE__) + end + + def zeitwerk? + return true if ActiveSupport::VERSION::MAJOR >= 7 + return false if ActiveSupport::VERSION::MAJOR <= 5 + + Rails.application.config.autoloader == :zeitwerk end end