edgarjs / ajaxful-rating

Provides a simple way to add rating functionality to your application.
http://rdoc.info/projects/edgarjs/ajaxful-rating
417 stars 127 forks source link

Star not updated after rating #26

Closed Ermin closed 14 years ago

Ermin commented 14 years ago

Let's say you have the following in your view: <%= ratings_for @publication, :show_user_rating => true %> When you submit a rating, the number of stars does not change. But if you reload the page, you notice that the rating has been successfully submited - number of stars has changed.

Workaround: <%= ratings_for @publication, :show_user_rating => true,:dimension => nil %>

Cause of the bug: @rated_model.wrapper_dom_id({"small"=>"false", "id"=>"5", "stars"=>"1", "dimension"=>""} ) => "_ajaxful_rating_no-small_publication_1"

@rated_model.wrapper_dom_id({"small"=>"false", "id"=>"5", "stars"=>"1"} ) => "ajaxful_rating_no-small_publication_1"

Notice that the second method call returns a string that does not begin with an underscore, because the parameter dimension is nil.

edgarjs commented 14 years ago

Got it, could you write a patch and send it to me or do a pull request with it please?

Thank you.

Ermin commented 14 years ago

Sorry, I am a newbie to git. Barely managed to make a patch. This will have to do: http://pastebin.com/CYTBhjFm

edgarjs commented 14 years ago

Thank you. The gem has been updated.

khanhnguyen commented 12 years ago

the issue still here. I using lastest version but still got this problem