Euro helper fix negative numbers, and reverse orders of orders on user#show
This commit is contained in:
parent
b37573a4be
commit
3b1a571b0b
2 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue