Fix order.created_by

This commit is contained in:
Julius 2013-01-12 16:24:13 +01:00
parent 099e2b9b06
commit ce0300df43
2 changed files with 2 additions and 4 deletions

View file

@ -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
end

View file

@ -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