Skip to content

Find methods Rails engines define under app/ - #231

Closed
apiology wants to merge 1 commit into
masterfrom
map-gem-app-directory
Closed

apiology wants to merge 1 commit into
masterfrom
map-gem-app-directory

Conversation

@apiology

Copy link
Copy Markdown
Owner

Claude: This PR was written by Claude Code on behalf of @apiology.

Problem

Methods from a Rails engine's app/ directory are not found:

class Post < ApplicationRecord
  include Turbo::Broadcastable # turbo-rails: app/models/concerns/turbo/broadcastable.rb
end

# Post#broadcast_replace: no definition
Post.new.broadcast_replace

This affects every engine that keeps code under app/, including turbo-rails, activestorage, actionmailbox, solid_queue and devise.

Solution

Collection::Gem#without_yard now parses app/**/*.rb alongside the gem's require paths, matching the {lib,app}/**/*.rb files YARD read before castwide#1378, without the plugin hook of castwide#1404 and castwide#1407.

YARD's ext/ glob is not included.

Collection::Gem#without_yard globbed only the gem's require_paths, so
code that Rails engines keep under app/ went unmapped once gems stopped
going through YARD, whose default source glob is {lib,app}/**/*.rb.
turbo-rails defines Turbo::Broadcastable in app/models/concerns, so
broadcast_* methods vanished from ActiveRecord::Base.

Add app/ to the mapped paths. Gems without an app/ directory map the
same pins as before.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SEntZKsZwQHhzqcwG7MTqn
@apiology

Copy link
Copy Markdown
Owner Author

Claude: Closing in favor of the convention-hook approach: castwide#1404, castwide#1407 and iftheshoefritz/solargraph-rails#228.

@apiology apiology closed this Oct 21, 2026
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.

1 participant