lib/parallel_tests/tasks.rb in parallel_tests-4.5.0 vs lib/parallel_tests/tasks.rb in parallel_tests-4.5.1
- old
+ new
@@ -136,10 +136,11 @@
def for_each_database(&block)
# Use nil to represent all databases
block&.call(nil)
- return unless defined?(ActiveRecord)
+ # skip if not rails or old rails version
+ return if !defined?(ActiveRecord::Tasks::DatabaseTasks) || !ActiveRecord::Tasks::DatabaseTasks.respond_to?(:for_each)
ActiveRecord::Tasks::DatabaseTasks.for_each(configured_databases) do |name|
block&.call(name)
end
end