Docs: mention that controller references should be kebab-case on manual registration to avoid issues with targets by stillhart · Pull Request #725 · hotwired/stimulus
Navigation Menu
{{ message }}
- Notifications You must be signed in to change notification settings
- Fork 443
Open
stillhart wants to merge 1 commit intohotwired:mainfrom
stillhart wants to merge 1 commit intohotwired:mainfrom
Conversation
Copy link
stillhart
commented
Oct 9, 2023
stillhart
commented
add an explizit line that kebab-case should be used when manually registering controller in order to avoid issues further down then line with targets. Technically snake_case also works, but that results in an unpredictable target naming. Especially in combination with the rails helper tag.div ... data: {foo_bar_target: :baz}
https://discord.com/channels/988103760050012160/1044659701213835294/1160906429109125240
…istering controller in order to avoid issues further down then line with targets. Technically snake_case also works, but that results in an unpredicable target naming. especially in combination with the rails helper tag.div ... data: {foo_bar_target: :baz}
marcoroth reviewed Oct 17, 2023
| application.register("reference", ReferenceController) | ||
| ``` | ||
|
|
||
| Use kebab-case in references to ensure features like targets function correctly (i.e., controllers/date_picker_controller, DatePickerController, date-picker) |
Copy link
Member
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think, would it instead make sense to update the example above to include the kebab-case version?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment