wazery / ratyrate

:star: A Ruby Gem that wraps the functionality of jQuery Raty library, and provides optional IMDB style rating.
http://ratingmoviestore.herokuapp.com
237 stars 120 forks source link

Not displaying star rating with turbolinks #34

Open wazery opened 10 years ago

wazery commented 10 years ago

Issue by rooshdi Thursday Jun 05, 2014 at 19:08 GMT Originally opened as https://github.com/muratguzel/letsrate/issues/72


I'm using turbolinks with Rails 4.1 and the star ratings don't display the selected rating upon visiting a new page.

sungwoncho commented 10 years ago

Using jQuery Turbolinks gem, I was able to get around this problem. Still it'd be great to have a permanent fix.

hechen0 commented 10 years ago

you don't have to use another gem to achieve this, a little hack to ' letsrate.js.erb ' will do the trick.

``` javascript
//before
$(function(){
   // original $.('.start') event binder
})

//after
$(document).on("page:change",function(){
     // original $.('.start') event binder
}
wazery commented 10 years ago

@Nxbtch Can you issue a PR with this?

hechen0 commented 10 years ago

@wazery glad to help

yonhaime commented 9 years ago

Well... I fix this problem File: ratyrate.js.erb Line6: $(document).on("ready page:load",function(){ //replace with this code

jacksonpires commented 7 years ago

In my case, this was the solution... File: ratyrate.js.erb Line6: $(document).bind('ready ajaxComplete', function(){ //replace with this code