ttf
ttf

Reputation: 53

jquery raty plugin not working with rails

I'm running rails 3.2, and trying to add a rating system using this: http://wbotelhos.com/raty/.

For some reason, even though I've added:

 $('#rating').raty();

to my script, and

 <div id="rating"></div>

to my html as shown at the website, I still can't see the stars.

I've added:

 //= require jquery.raty

to my application.js, and have jquery.raty.js in my javascripts folder.

I can't seem to figure out what I'm doing wrong.

I've tried using a gem: https://github.com/bmc/jquery-raty-rails and that doesn't work either

Upvotes: 1

Views: 1542

Answers (2)

kchoi
kchoi

Reputation: 1215

Did you add the photos for the stars? Make sure that you have star-on.png and star-off.png in assets/images Also, add the following code in your html.erb file,

<script>
    $(document).ready(function() {
        $("#rating").raty({
            path: '/assets/'
        });
    })
</script>

Upvotes: 2

user2398682
user2398682

Reputation: 74

You need to include the javascript call:

$('#star').raty();

in order to get

<div id="star"></div>

to show.

Upvotes: -1

Related Questions