Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Enhancement
Description
This PR adds a
ConcernEnhancer
module that can be included alongside anActiveSupport::Concern
(on which's existence it depends), producing a concern that can be used by both reflex and controller (and models, for that matter) without having to guard against undefined methods (likehelper_method
,before_action
etc.).It basically adds a
method_missing
class method to the includer, which will stub class methods for the counterpart after switching on the ancestor (whether it's aStimulusReflex::Reflex
,ActionController::Base
etc.)NOTE for docs: this module has to be
include
d as opposed toActiveSupport::Concern
, which has to beextend
ed:Why should this be added
To more resiliently share code between controllers/models and reflexes
Checklist
Please note that the best way to suggest changes or updates to the documentation is to join Discord and leave a note in the #docs channel. Any documentation updates posted as PRs cannot be accepted at this time. ❤️