Fix order.created_by
This commit is contained in:
parent
099e2b9b06
commit
ce0300df43
2 changed files with 2 additions and 4 deletions
|
@ -60,6 +60,7 @@ class OrdersController < ApplicationController
|
||||||
# order_articles will be saved in Order.article_ids=()
|
# order_articles will be saved in Order.article_ids=()
|
||||||
def create
|
def create
|
||||||
@order = Order.new(params[:order])
|
@order = Order.new(params[:order])
|
||||||
|
@order.created_by = current_user
|
||||||
if @order.save
|
if @order.save
|
||||||
flash[:notice] = "Die Bestellung wurde erstellt."
|
flash[:notice] = "Die Bestellung wurde erstellt."
|
||||||
redirect_to @order
|
redirect_to @order
|
||||||
|
|
|
@ -19,9 +19,6 @@ class Order < ActiveRecord::Base
|
||||||
validate :starts_before_ends, :include_articles
|
validate :starts_before_ends, :include_articles
|
||||||
|
|
||||||
# Callbacks
|
# Callbacks
|
||||||
before_create do |order|
|
|
||||||
order.created_by = User.current_user
|
|
||||||
end
|
|
||||||
after_update :update_price_of_group_orders
|
after_update :update_price_of_group_orders
|
||||||
after_save :save_order_articles
|
after_save :save_order_articles
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue