Closed ZSeba closed 8 years ago
Hi @ZSeba! I don't know RoR very well... but, from a JavaScript perspective, I can point you to some possible causes of this error:
Uncaught TypeError: $(...).rating is not a function
This could be caused because:
bootstrap-rating
plugin has not been properly included.bootstrap-rating
plugin has been included, but before jquery
. I mean, in this case the order is important. You must include jquery
before bootstrap-rating
plugin because the plugin relies on jQuery.Maybe someone else could help you out or you can try to ask in Stackoverflow.
Hope it helps!
Hey, @dreyescat
Thank you for your answer. I figured what I got wrong. I was using the Rails assets pipeline wrong. Now the plugin is working perfectly on my app! :smile:
Glad you managed to make it work 👍 .
I close the issue as resolved.
Hey there!
First of all, thank you for making this. Of all the plugins I could find, this one seems the most useful for my purposes.
I'm having a little trouble running this RoR.
I've imported four files into my project. "bootstrap-ratings" ,"bootstrap-ratings.min" and "Gruntfile" javascripts in my application.js file, and "bootstrap-rating.css into mi application.scss file.
application.js
//= require jquery //= require jquery_ujs //= require turbolinks //= require_tree . //= require bootstrap-sprockets //= require bootstrap.min //= require bootstrap-rating //= require bootstrap-rating.min
aplication.scss
@import "bootstrap"; @import "bootstrap.min"; @import "bootstrap-rating";
When I use in my view, it looks fine, but if I try to use$('input').rating(2);
for example (setting the rating to default to 2) in my reviews.coffee file ('Reviews' is the controller I'm using in this project) I get the following error.Uncaught TypeError: $(...).rating is not a function
Also, if I try to attach an event, like in the example:
I'm getting SyntaxError: [stdin]:5:25: reserved word "function"
What am I doing wrong? Any help is greatly appreciated.