- Create a new Stimulus controller file, either:
- with
rails g stimulus my_feature
, or - by manually adding a file in the
controllers
directory of your Rails application, e.g.,app/javascript/controllers/my_feature_controller.js
.
- The controller file should define your Stimulus controller class: