Allow to pass reflex action names to reflex generator #224
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.
Type of PR (feature, enhancement, bug fix, etc.)
Enhancement
Description
This PR allows to call the stimulus_reflex generator with reflex action names.
e.g.
rails g stimulus_reflex User update do_stuff
which will generate:
Lifecycle methods as comments in the generated Stimulus controller
I also added the feature, that the generator adds all lifecycle methods for each given action as a comment in the generated stimulus controller. I don't know if this adds a lot of value or if we should remove it again because it adds a lot of unnecessary "noise".
It would look like this:
Refactoring
I also took the opportunity to clean up the
StimulusReflexGenerator
class a little bit. Let me know if this isn't a change you'd like to see.I did both, the lifecycle method generation and the refactoring, in two separate commits to easily revert them if needed.
Fixes #219 (/cc @julianrubisch).
Why should this be added
This change lets the user even go faster if the user already knows how the reflex should be structured.
Checklist