Euro helper fix negative numbers, and reverse orders of orders on user#show

This commit is contained in:
benji 2015-02-12 15:31:32 +01:00
parent b37573a4be
commit 3b1a571b0b
2 changed files with 2 additions and 2 deletions

View file

@ -3,7 +3,7 @@ class UsersController < ApplicationController
def show
@user = User.find_by_id(params[:id]) || current_user
@orders = @user.orders.includes(:products).paginate(page: params[:page])
@orders = @user.orders.includes(:products).order(:created_at).reverse_order.paginate(page: params[:page])
@products = @user.products.select("products.*", "sum(order_items.count) as count").group(:product_id)
@categories = @user.products.select("products.category", "sum(order_items.count) as count").group(:category)
end

View file

@ -10,7 +10,7 @@ module ApplicationHelper
end
def euro(f)
"#{number_with_precision f, precision: 2}"
number_to_currency(f, unit: '€')
end
def f_form_for(record, options = {}, &block)