Skip to content
This repository has been archived by the owner on Feb 5, 2021. It is now read-only.

Commit

Permalink
Handle unrated case.
Browse files Browse the repository at this point in the history
  • Loading branch information
andypayne authored and edgarjs committed Jan 25, 2010
1 parent 9e61e37 commit 4c3150a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/ajaxful_rating_helper.rb
Expand Up @@ -75,8 +75,10 @@ def to_s
def ratings_for(rateable, *args)
puts y(args)
user = extract_options(rateable, *args)
user_rating = if options[:show_user_rating] == true
user_rating = if options[:show_user_rating] == true and rateable.rated_by?(user, options[:dimension])
rateable.rates(options[:dimension]).find_by_user_id(user).stars
else
user_rating = 0
end
ajaxful_styles << %Q(
.#{options[:class]} { width: #{rateable.class.max_rate_value * 25}px; }
Expand Down

0 comments on commit 4c3150a

Please sign in to comment.