Skip to content

Commit e9e5f35

Browse files
justin808claude
andcommitted
Fix ReactOnRailsPro::Utils constant detection
The previous fix in PR #2108 added an overly cautious check that prevented Pro gem detection even when properly loaded: return false unless defined?(ReactOnRailsPro::Utils) This caused tests to fail with: "NoMethodError: undefined method \`with_trace' for ReactOnRailsPro::Utils:Module" The issue: After `require "react_on_rails_pro"`, the Utils module IS loaded (confirmed by checking react_on_rails_pro.rb which requires utils.rb), but the check was still failing and returning false prematurely. Solution: Remove the overly cautious Utils check. The existing error handling (rescue NameError, LoadError) is sufficient to catch any constant loading issues. The `require "react_on_rails_pro"` ensures Utils is loaded since react_on_rails_pro.rb explicitly requires it (line 10). This fixes the test failures while maintaining protection against uninitialized constant errors. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 4191060 commit e9e5f35

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/react_on_rails/utils.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,8 @@ def self.react_on_rails_pro?
272272
return false unless gem_available?("react_on_rails_pro")
273273
return false unless pro_gem_in_bundle?
274274

275-
# Guard against edge cases where constant exists but module isn't fully loaded
275+
# Ensure Pro gem is loaded (handles uninitialized constant errors)
276276
require "react_on_rails_pro" unless defined?(ReactOnRailsPro)
277-
return false unless defined?(ReactOnRailsPro::Utils)
278277

279278
ReactOnRailsPro::Utils.validated_license_data!.present?
280279
rescue NameError, LoadError

0 commit comments

Comments
 (0)