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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -