0
I am implementing a part of notifications in a Rails project, from a tutorial and am getting this error.
Uncaught ReferenceError: jQuery is not defined at notifications.self-3e6330e4ab7198d8dee61da361c9c6cd1a536fd445b9ce4b6792ea023705ae80.js?body=1:20 at notifications.self-3e6330e4ab7198d8dee61da361c9c6cd1a536fd445b9ce4b6792ea023705ae80.js?body=1:24
My Notifications.coffee is like this
class Notifications
constructor: ->
@notifications = $("[data-behavior='notifications']")
@setup() if @notifications.length > 0
setup: ->
console.log(@notifications)
jQuery ->
new Notifications
and is generating the following . js
(function() {
var Notifications;
Notifications = (function() {
function Notifications() {
this.notifications = $("[data-behavior='notifications']");
if (this.notifications.length > 0) {
this.setup();
}
}
Notifications.prototype.setup = function() {
return console.log(this.notifications);
};
return Notifications;
})();
jQuery(function() { //linha 20
return new Notifications;
});
}).call(this); //linha 24
My html like this
<li class="nav-item btn-group" data-behavior="notifications">
<a class="dropdown-toggle nav-link" type="button" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="">
Notifications <b class="caret"></b>
</a>
<div class="dropdown-menu" aria-labelledby="dropdownMenu1">
<a class="dropdown-item" href="#">Action</a><br />
<a class="dropdown-item" href="#">Another action</a><br />
<a class="dropdown-item" href="#">Something else here</a><br />
</div>
</li>