Fix: explicitly require react_on_rails in react_on_rails_pro.rb#2492
Fix: explicitly require react_on_rails in react_on_rails_pro.rb#2492
Conversation
Mirrors the JS package split design: react-on-rails-pro declares react-on-rails as a dependency and users only need one entry point. The Ruby gem was never updated to match — it relied on Bundler.require loading react_on_rails first via explicit Gemfile listing. With docs now directing users to only list react_on_rails_pro in their Gemfile, react_on_rails is never auto-required, causing two failures: - NoMethodError: undefined method strip_heredoc (license_public_key.rb) - NoMethodError: undefined method configure for module ReactOnRails Adding require "react_on_rails" ensures the full core gem loads regardless of Gemfile order or whether the user lists it explicitly. Fixes #2491 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
WalkthroughAdded an explicit Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code ReviewOverall: The fix is correct, minimal, and well-motivated. The root cause analysis in the PR description is thorough and accurate. What the PR doesAdds Positive aspects
One issue: CHANGELOG entry missingThis fix resolves user-facing boot failures ( Example entry: - **Explicit require of react_on_rails in react_on_rails_pro**: Fixed boot failures (`NoMethodError: undefined method 'strip_heredoc'` and `NoMethodError: undefined method 'configure' for module ReactOnRails`) when only `react_on_rails_pro` is listed in the Gemfile. The gem now explicitly requires its `react_on_rails` runtime dependency rather than relying on Bundler auto-require ordering. [PR 2492](https://github.com/shakacode/react_on_rails/pull/2492) by [ihabadham](https://github.com/ihabadham).SummaryThe fix itself is ship-ready. The only request is to add a CHANGELOG entry before merging. |
Greptile SummaryAdds explicit What changed:
Why this fix is correct:
Resolved issues:
Confidence Score: 5/5
Important Files Changed
Last reviewed commit: 3b1fca9 |
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
ReviewThe fix is correct and well-reasoned. A few notes: What is right:
One suggestion — inline code comment: Test coverage gap: CHANGELOG: Correctly placed under Pro > Fixed, well-written entry. |
Summary
Fixes #2491
react_on_rails_pro.rbnever explicitly requiredreact_on_rails, relying instead onBundler.requireto auto-require it via the user's Gemfile. This worked as long as users listed both gems explicitly —react_on_railssorts alphabetically beforereact_on_rails_pro, so Bundler always loaded the core gem first.When installation docs were updated (PR #2252) to direct users to only add
react_on_rails_proto their Gemfile,Bundler.requirestopped auto-requiring the core gem (Bundler only requires explicitly listed gems, not transitive dependencies). This caused two boot failures:NoMethodError: undefined method 'strip_heredoc' for an instance of String—active_support/core_ext/string/stripwas never loadedNoMethodError: undefined method 'configure' for module ReactOnRails—react_on_rails_pro.rbpartially opens theReactOnRailsnamespace via individual internal requires (react_on_rails/error,react_on_rails/utils), butconfigureis only defined when the fullreact_on_rails.rbis loadedFix
Add
require "react_on_rails"toreact_on_rails_pro.rb. This completes what the JS package split (PR #1841) established as the intended design: Pro users get everything from a single entry point. The npm package already does this correctly by declaringreact-on-railsas a dependency and re-exporting it. The Ruby gem now matches that contract.This is standard Ruby gem practice — a gem with a hard runtime dependency should load it explicitly rather than relying on the consumer's Gemfile.
Verification
Both errors reproduced locally against master, both resolved by this fix:
Test plan
react_on_rails_proin the Gemfile — no errorsSummary by CodeRabbit
Bug Fixes
Chores