Merge pull request #341 from aboutsource/fix-order-edit-loading
Fixed broken eager loading in orders#edit.
This commit is contained in:
commit
7d3d524107
1 changed files with 7 additions and 7 deletions
|
@ -3,10 +3,10 @@
|
||||||
# Controller for managing orders, i.e. all actions that require the "orders" role.
|
# Controller for managing orders, i.e. all actions that require the "orders" role.
|
||||||
# Normal ordering actions of members of order groups is handled by the OrderingController.
|
# Normal ordering actions of members of order groups is handled by the OrderingController.
|
||||||
class OrdersController < ApplicationController
|
class OrdersController < ApplicationController
|
||||||
|
|
||||||
before_filter :authenticate_orders
|
before_filter :authenticate_orders
|
||||||
before_filter :remove_empty_article, only: [:create, :update]
|
before_filter :remove_empty_article, only: [:create, :update]
|
||||||
|
|
||||||
# List orders
|
# List orders
|
||||||
def index
|
def index
|
||||||
@open_orders = Order.open.includes(:supplier)
|
@open_orders = Order.open.includes(:supplier)
|
||||||
|
@ -82,7 +82,7 @@ class OrdersController < ApplicationController
|
||||||
# Page to edit an exsiting order.
|
# Page to edit an exsiting order.
|
||||||
# editing finished orders is done in FinanceController
|
# editing finished orders is done in FinanceController
|
||||||
def edit
|
def edit
|
||||||
@order = Order.find(params[:id], :include => :articles)
|
@order = Order.includes(:articles).find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
# Update an existing order.
|
# Update an existing order.
|
||||||
|
@ -101,7 +101,7 @@ class OrdersController < ApplicationController
|
||||||
Order.find(params[:id]).destroy
|
Order.find(params[:id]).destroy
|
||||||
redirect_to :action => 'index'
|
redirect_to :action => 'index'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finish a current order.
|
# Finish a current order.
|
||||||
def finish
|
def finish
|
||||||
order = Order.find(params[:id])
|
order = Order.find(params[:id])
|
||||||
|
@ -121,19 +121,19 @@ class OrdersController < ApplicationController
|
||||||
redirect_to @order
|
redirect_to @order
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive_on_order_article_create # See publish/subscribe design pattern in /doc.
|
def receive_on_order_article_create # See publish/subscribe design pattern in /doc.
|
||||||
@order_article = OrderArticle.find(params[:order_article_id])
|
@order_article = OrderArticle.find(params[:order_article_id])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
def receive_on_order_article_update # See publish/subscribe design pattern in /doc.
|
def receive_on_order_article_update # See publish/subscribe design pattern in /doc.
|
||||||
@order_article = OrderArticle.find(params[:order_article_id])
|
@order_article = OrderArticle.find(params[:order_article_id])
|
||||||
render :layout => false
|
render :layout => false
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def update_order_amounts
|
def update_order_amounts
|
||||||
return if not params[:order_articles]
|
return if not params[:order_articles]
|
||||||
# where to leave remainder during redistribution
|
# where to leave remainder during redistribution
|
||||||
|
|
Loading…
Reference in a new issue