diff --git a/app/models/order.rb b/app/models/order.rb index cf6a450..a73aba2 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -48,7 +48,7 @@ class Order < ActiveRecord::Base def to_sentence self.order_items.map { - |oi| pluralize(oi.count, oi.product.name) + |oi| oi.count.to_s + " " + oi.product.name.pluralize(oi.count, :nl) }.to_sentence end diff --git a/app/models/order_item.rb b/app/models/order_item.rb index 534e3da..66322be 100644 --- a/app/models/order_item.rb +++ b/app/models/order_item.rb @@ -13,7 +13,7 @@ class OrderItem < ActiveRecord::Base belongs_to :product validates :product, presence: true - validates :count, numericality: { only_integer: true, greater_than_or_equal_to: 0 } + validates :count, numericality: { only_integer: true, greater_than_or_equal_to: 0, smaller_than_or_equal_to: 10000 } after_create :remove_from_stock diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index b869e1f..631bca0 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -19,7 +19,7 @@
Specifics:

All orders (<%= @user.orders_count %>)