Episodes
j.estrada said over 2 years ago on Polling with StimulusJS :
I think it is a great video, very well explained. Just to confirm, the reason why the rails ujs library is not necessary for me is because my version of rails is newer, or does it have to do with webpack and the way stimulus is now integrated with the whole ecosystem of rails?

David Kimura PRO said over 2 years ago on Polling with StimulusJS :
  It has to do with webpacker having the RailsUJS installed. So we import it into our stimilus controller at the top. Otherwise the Rails command within the stimulus controller would not be defined. If you had it defined in the window or extended in Webpacker, then you might not have to import it, but I don't like doing that much as it creates too much cross dependencies (changing a file in one location would affect the functionality of another location).

j.estrada said over 2 years ago on Polling with StimulusJS :
so, having the //= require rails-ujs on my app>assets>javascript>application.js asset could create too much cross dependencies?, and your recommendations is avoid having it here?

David Kimura PRO said over 2 years ago on Polling with StimulusJS :
That's fine as it would be used for nonstimulus scripts. i mean more of having something like this

window.Rails = require("rails-ujs")


Login to Comment