Fix #47
This commit is contained in:
parent
8e5ccfed7a
commit
eda0d86e74
3 changed files with 3 additions and 3 deletions
|
@ -48,7 +48,7 @@ class Order < ActiveRecord::Base
|
||||||
|
|
||||||
def to_sentence
|
def to_sentence
|
||||||
self.order_items.map {
|
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
|
}.to_sentence
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class OrderItem < ActiveRecord::Base
|
||||||
belongs_to :product
|
belongs_to :product
|
||||||
|
|
||||||
validates :product, presence: true
|
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
|
after_create :remove_from_stock
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<br/>
|
<br/>
|
||||||
Specifics:<br/>
|
Specifics:<br/>
|
||||||
<ul>
|
<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>
|
</ul>
|
||||||
|
|
||||||
<h4>All orders (<%= @user.orders_count %>)</h4>
|
<h4>All orders (<%= @user.orders_count %>)</h4>
|
||||||
|
|
Loading…
Reference in a new issue