ruby on rails - I'm using raty.js star rating system, how do I show the equivalent integer value of star for my avg. rating? -
the code below show example:
average rating
**
based on 2 reviews
so since it's average rating 2 stars, how show integer value "2"? like:
** 2
<h2 class="avg-rating">average rating</h2> <div class="average-review-rating" data-score=<%= @average_review %>></div> <span class="number-of-reviews">based on <%= @book.reviews.count %> reviews</span> <script> $('.average-review-rating').raty({ readonly: true, path: '/assets/', score: function() { return $(this).attr('data-score') } }); </script>
why not just:
<div class="average-review-rating" data-score=<%= @average_review %>> <%= @average_review %></div>
this output average score literal value.
Comments
Post a Comment