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

Canceling rating should delete the rating #100

Open robban opened 9 years ago

robban commented 9 years ago

Currently, when you press the cancel rating button, it essentially works as a rating with zero stars. This draws down the average rating. Correct behaviour would be to delete the rating if it exists in the database.

piyushbeli commented 8 years ago

I am also looking for the same thing, I went through the source code of gem but did not find any method for deleting the rate.

piyushbeli commented 8 years ago

Just in case if somebody is looking for a patch then here it is. I overode this module and added clear_rating method. Also need to override the update_rating_cahce method to give the correct average_rating.

Please see this gist https://gist.github.com/piyushbeli/8b92068ce72d28ed155a

mrobock commented 7 years ago

@piyushbeli Thank you for the fix! I'm not sure how to implement it though, having already installed ratyrate. I can't find anything called "ratyrate" doing a project-wide search in my app. Can you provide any additional implementation advice? Thanks again!