fix minor bug

This commit is contained in:
benji 2015-02-04 17:09:42 +01:00
parent 4b05623a96
commit 9e4563fbd1

View file

@ -4,8 +4,8 @@ class UsersController < ApplicationController
def show def show
@user = User.find_by_id(params[:id]) || current_user @user = User.find_by_id(params[:id]) || current_user
@orders = Order.joins(:products).select(:count, "products.*", "orders.id").where(user: @user).group_by &:id @orders = Order.joins(:products).select(:count, "products.*", "orders.id").where(user: @user).group_by &:id
@products = @user.products.select("products.*", "count(products.id) as count").group(:product_id) @products = @user.products.select("products.*", "sum(order_products.count) as count").group(:product_id)
@categories = @user.products.select("products.category", "count(products.category) as count").group(:category) @categories = @user.products.select("products.category", "sum(order_products.count) as count").group(:category)
end end
def index def index