From 92b962e6b9e35d098016a4104ea3082cd0deb4b5 Mon Sep 17 00:00:00 2001 From: Dan Elbert Date: Wed, 28 Sep 2016 17:18:17 -0500 Subject: [PATCH] Fixed nil rating bug --- app/decorators/recipe_decorator.rb | 4 ---- app/views/recipes/index.html.erb | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/app/decorators/recipe_decorator.rb b/app/decorators/recipe_decorator.rb index 6b38bba..49de7d2 100644 --- a/app/decorators/recipe_decorator.rb +++ b/app/decorators/recipe_decorator.rb @@ -24,8 +24,4 @@ class RecipeDecorator < BaseDecorator end end - def average_rating - rating - end - end \ No newline at end of file diff --git a/app/views/recipes/index.html.erb b/app/views/recipes/index.html.erb index 8fbaa71..39f3674 100644 --- a/app/views/recipes/index.html.erb +++ b/app/views/recipes/index.html.erb @@ -33,8 +33,8 @@ <%= link_to recipe.short_name, recipe %> - <% if recipe.average_rating > 0 %> - <%= text_field_tag('rating', recipe.average_rating, disabled: true, data: {rating: true, size: '20px', interval: '0.25'}) %> + <% if recipe.rating %> + <%= text_field_tag('rating', recipe.rating, disabled: true, data: {rating: true, size: '20px', interval: '0.25'}) %> <% else %> -- <% end %>