From ce0300df431986775a1a71dfe9410a0fced8c85f Mon Sep 17 00:00:00 2001 From: Julius Date: Sat, 12 Jan 2013 16:24:13 +0100 Subject: [PATCH] Fix order.created_by --- app/controllers/orders_controller.rb | 3 ++- app/models/order.rb | 3 --- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index 31baa680..a123179a 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -60,6 +60,7 @@ class OrdersController < ApplicationController # order_articles will be saved in Order.article_ids=() def create @order = Order.new(params[:order]) + @order.created_by = current_user if @order.save flash[:notice] = "Die Bestellung wurde erstellt." redirect_to @order @@ -125,4 +126,4 @@ class OrdersController < ApplicationController :type => 'text/plain; charset=utf-8; header=present', :disposition => "attachment; filename=#{order.name}" end -end \ No newline at end of file +end diff --git a/app/models/order.rb b/app/models/order.rb index c6c4341b..5956b224 100644 --- a/app/models/order.rb +++ b/app/models/order.rb @@ -19,9 +19,6 @@ class Order < ActiveRecord::Base validate :starts_before_ends, :include_articles # Callbacks - before_create do |order| - order.created_by = User.current_user - end after_update :update_price_of_group_orders after_save :save_order_articles