Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loading all Tasks with namespace collision #939

Merged
merged 1 commit into from
Dec 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ PATH
activerecord (>= 6.0)
job-iteration (>= 1.3.6)
railties (>= 6.0)
zeitwerk (>= 2.6.2)

GEM
remote: https://rubygems.org/
Expand Down
8 changes: 1 addition & 7 deletions app/models/maintenance_tasks/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,13 +187,7 @@ def load_constants
namespace = MaintenanceTasks.tasks_module.safe_constantize
return unless namespace

load_const = lambda do |root|
root.constants.each do |name|
object = root.const_get(name)
load_const.call(object) if object.instance_of?(Module)
end
end
load_const.call(namespace)
Rails.autoloaders.main.eager_load_namespace(namespace)
end
end

Expand Down
1 change: 1 addition & 0 deletions maintenance_tasks.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ Gem::Specification.new do |spec|
spec.add_dependency("activerecord", ">= 6.0")
spec.add_dependency("job-iteration", ">= 1.3.6")
spec.add_dependency("railties", ">= 6.0")
spec.add_dependency("zeitwerk", ">= 2.6.2")
end