Module: Caboose::ProductsHelper
- Defined in:
- app/helpers/caboose/products_helper.rb
Instance Method Summary collapse
Instance Method Details
#active_products ⇒ Object
18 19 20 |
# File 'app/helpers/caboose/products_helper.rb', line 18 def active_products Caboose::Product.active end |
#average_review(product_id) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'app/helpers/caboose/products_helper.rb', line 4 def average_review(product_id) all_reviews = Review.where(:product_id => product_id) score = 0 count = 0 all_reviews.each do |r| if r. && r. != 0 score += r. count += 1 end end return score/count if count > 0 return 0 end |
#caboose_sort_options ⇒ Object
22 23 24 |
# File 'app/helpers/caboose/products_helper.rb', line 22 def render :partial => '/caboose/products/sort_options' end |