Gem depends on active_model, but doesn't require it before using it
Closed this issue · 0 comments
technicalpickles commented
I'm adding this gem to our project, and found problems when using sidekiq's sidekiqswam:
[swarm] Preloading Bundler groups ["default"]
/Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_storage_validations-1.0.4/lib/active_storage_validations/attached_validator.rb:4:in `<module:ActiveStorageValidations>': uninitialized constant ActiveStorageValidations::ActiveModel (NameError)
class AttachedValidator < ActiveModel::EachValidator # :nodoc:
^^^^^^^^^^^^^^^
Did you mean? ActiveSupport
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_storage_validations-1.0.4/lib/active_storage_validations/attached_validator.rb:3:in `<top (required)>'
from <internal:/Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from <internal:/Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:37:in `require'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/active_storage_validations-1.0.4/lib/active_storage_validations.rb:6:in `<top (required)>'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.17/lib/bundler/runtime.rb:60:in `require'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.17/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.17/lib/bundler/runtime.rb:55:in `each'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.17/lib/bundler/runtime.rb:55:in `block in require'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.17/lib/bundler/runtime.rb:44:in `each'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.17/lib/bundler/runtime.rb:44:in `require'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/bundler-2.4.17/lib/bundler.rb:187:in `require'
from /Users/josh.nichols/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/sidekiq-ent-2.5.3/bin/sidekiqswarm:40:in `<top (required)>'
from bin/sidekiqswarm:27:in `load'
from bin/sidekiqswarm:27:in `<main>'
This doesn't affect any of the rails
commands, or regular sidekiq
, just sidekiqswarm
.
I looked around the code a little, and it seems that while activemodel is a gem dependency, it's not required before the constant is used