Sha256: 4ad3278c32e7fbb5ef44163b4047b14023cda7e169536f0675012a681441e0fd
Contents?: true
Size: 552 Bytes
Versions: 664
Compression:
Stored size: 552 Bytes
Contents
module Caboose module ProductsHelper def average_review(product_id) all_reviews = Review.where(:product_id => product_id) score = 0 count = 0 all_reviews.each do |r| if r.rating && r.rating != 0 score += r.rating count += 1 end end return score/count if count > 0 return 0 end def active_products Caboose::Product.active end def caboose_sort_options render :partial => '/caboose/products/sort_options' end end end
Version data entries
664 entries across 664 versions & 1 rubygems