Why my javascript file isn't loading? (Rails)
The insidious nature of bugs that you are blind to, means that you can never find it.
I wanted to load a javascript file - but it wasn’t working. Did I:
-
install the gem correctly?
-
add it to the application.js file - and the stylesheet file as well?
-
why is there an error still popping up.
It was then that I realised that the equivalent coffeescript file was also existing. Once I deleted the employees.coffee
and left the employees.js
file still standing. It magically worked!
Moral of the story
-
Take things step by step and test each one independently.
-
Make sure you have a good underlying understanding of what you are doing. Because if you have any gaps in your knowledge, then you could be spending a lot of time debugging.
Written on January 12, 2018