This commit is contained in:
benji 2015-04-04 03:26:25 +02:00
parent 8e5ccfed7a
commit eda0d86e74
3 changed files with 3 additions and 3 deletions

View file

@ -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

View file

@ -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

View file

@ -19,7 +19,7 @@
<br/>
Specifics:<br/>
<ul>
<%= @products.map{ |p| content_tag(:li, pluralize(p.count, p.name)) }.join("\n").html_safe %>
<%= @products.map{ |p| content_tag(:li, p.count.to_s + " " + p.name.pluralize(p.count, :nl)) }.join("\n").html_safe %>
</ul>
<h4>All orders (<%= @user.orders_count %>)</h4>