Clean up OrderArticle#new form and related stuff

This commit is contained in:
Julius 2013-12-31 12:27:10 +01:00 committed by wvengen
parent baa5f16cfc
commit 01264bc0ac
7 changed files with 13 additions and 6 deletions

View file

@ -18,11 +18,11 @@ class OrderArticlesController < ApplicationController
if @order_article and @order_article.units_to_order == 0
@order_article.units_to_order = 1
else
@order_article = @order.order_articles.build(params[:order_article])
end
unless @order_article.save
render action: :new
@order_article = OrderArticle.new(params[:order_article])
end
@order_article.save!
rescue
render action: :new
end
def edit