I'm currently developping a website using Rails (5.0.2). I'm using Materialize as a framework to make my website pleasant.
I'm having an issue with the DatePicker. I need to initialize it with JQuery with something like that $('#idOfMyDatePicker').pickadate();
It works great in dev environment but as soon as I put it on Heroku, I get this error : Uncaught TypeError: $(...).pickadate is not a function
.
You should know that I'm a bit of a newbie in Rails and not an expert in Javascript.
That said I investigated a bit and found out that, in dev, when I call $(...).pickadate();
it goes in $.fn[ name ] = function( options, action )
. I never saw this kind of declaration before so I don't get how calling pickadate()
could result in going there.
In production, this piece of code is also present, but for whatever reason, it doesn't go in there, it just assumes that the function is not defined.
I don't know if it's a problem of Materialize, or the pickadate.js or if I'm including my files the wrong way...
Thanks for your help !