Merge pull request #99 from balkansalat/rails3-fix-stock-ordering-2
Prevent sold-out articles from being removed from stock order when editing
This commit is contained in:
commit
28343fc124
2 changed files with 8 additions and 1 deletions
|
|
@ -49,6 +49,11 @@ class Article < ActiveRecord::Base
|
|||
end
|
||||
memoize :in_open_order
|
||||
|
||||
# Returns true if the article has been ordered in the given order at least once
|
||||
def ordered_in_order?(order)
|
||||
order.order_articles.where(article_id: id).where('quantity > 0').one?
|
||||
end
|
||||
|
||||
# this method checks, if the shared_article has been changed
|
||||
# unequal attributes will returned in array
|
||||
# if only the timestamps differ and the attributes are equal,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue