Skip to content

Fix missing require for with_indifferent_access outside Rails - #39

Merged
sebscholl merged 1 commit into
zarpay:mainfrom
keithmgould:fix/require-indifferent-access
May 9, 2026
Merged

Fix missing require for with_indifferent_access outside Rails#39
sebscholl merged 1 commit into
zarpay:mainfrom
keithmgould:fix/require-indifferent-access

Conversation

@keithmgould

Copy link
Copy Markdown
Contributor

Was playing around with Servus outside of Rails and came upon this issue.

  • Fix missing require 'active_support/core_ext/hash/indifferent_access' in gem/lib/servus.rb
  • The gem uses with_indifferent_access in 6 places (base.rb, event.rb, validator.rb) but never explicitly requires the ActiveSupport extension that provides it
  • Works in Rails because Rails eagerly loads all of ActiveSupport; breaks in plain Ruby/Rack apps with NoMethodError: undefined method 'with_indifferent_access' for
    an instance of Hash

Test plan

  • Verified the single-line change adds the require alongside the existing core_ext/class/attribute require
  • Run existing test suite to confirm no regressions
  • Test in a non-Rails Ruby app (e.g. plain Rack) to confirm the fix resolves the NoMethodError

The gem uses with_indifferent_access in multiple places but only
required active_support/core_ext/class/attribute. This works in Rails
(which eagerly loads all of ActiveSupport) but breaks in plain Ruby/Rack
apps with NoMethodError on Hash.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sebscholl
sebscholl merged commit 06d19d4 into zarpay:main May 9, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants