show proper error when all articles are deselected in order edit

This commit is contained in:
wvengen 2014-05-06 11:40:57 +02:00
parent 4c1e5e2b00
commit 5d9c9856d1
2 changed files with 7 additions and 0 deletions

View file

@ -5,6 +5,7 @@
class OrdersController < ApplicationController
before_filter :authenticate_orders
before_filter :remove_empty_article, only: [:create, :update]
# List orders
def index
@ -174,4 +175,8 @@ class OrdersController < ApplicationController
notice.join(', ')
end
def remove_empty_article
params[:order][:article_ids].reject!(&:blank?) if params[:order] and params[:order][:article_ids]
end
end