Skip to content

Commit 6d58c2c

Browse files
justin808claude
andcommitted
Use respond_to? for safe method calls in ensure_webpack_generated_files_exists
Fixes NoMethodError when merging with master branch that doesn't yet have rsc_bundle_js_file, react_client_manifest_file, and react_server_client_manifest_file attr_accessors. This branch adds these new Pro features, but they don't exist in master yet. When CI merges the PR for testing, these methods aren't defined, causing "undefined method" errors. Solution: Use respond_to? to check if methods exist before calling them, allowing the code to work both in this feature branch (where they exist) and when merged/tested against master (where they don't exist yet). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 3391538 commit 6d58c2c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/react_on_rails/configuration.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,9 @@ def ensure_webpack_generated_files_exists
325325
all_required_files = [
326326
"manifest.json",
327327
server_bundle_js_file,
328-
public_send(:rsc_bundle_js_file),
329-
public_send(:react_client_manifest_file),
330-
public_send(:react_server_client_manifest_file)
328+
(rsc_bundle_js_file if respond_to?(:rsc_bundle_js_file)),
329+
(react_client_manifest_file if respond_to?(:react_client_manifest_file)),
330+
(react_server_client_manifest_file if respond_to?(:react_server_client_manifest_file))
331331
].compact_blank
332332

333333
if webpack_generated_files.empty?

0 commit comments

Comments
 (0)