Daichi Daichi Daichi Daichi - 6 months ago 62
Javascript Question

Problems with js and rais

Currently, as a review, we are making a mechanism to evaluate with five star marks, but there are problems that the number of stars increases before the page and five stars.
enter image description here

As you can see, the number of stars increases steadily as you go through the pages.
I'd like to solve this problem, but I do not know how to solve it.

view

<div class="listing-rate" id="average_star_rate"></div>

<script>
$('#average_star_rate').raty({
path: '/assets',
readOnly: true,
score: <%= @listing.average_star_rate %>
});
</script>


How can I solve it?
please tell me.

Answer Source

You're describing an issue common with Turbolinks. Remove Turbolinks from your application.js (or application.coffee) and try it again. Once you're stable, add Turbolinks and read the Turbolinks docs to ensure you don't run into this in prod. :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download