Fixed saving user for new orders.
This commit is contained in:
parent
44ef0a9807
commit
8b2b70f8bf
3 changed files with 3 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -142,7 +142,8 @@ module ApplicationHelper
|
|||
# offers a link for writing message to user
|
||||
# checks for nil (useful for relations)
|
||||
def link_to_user_message_if_valid(user)
|
||||
user.nil? ? '??' : ( link_to user.nick, user_message_path(user), :title => 'Nachricht schreiben' )
|
||||
user.nil? ? '??' : link_to(user.nick, new_message_path('message[mail_to]' => user.id),
|
||||
:title => 'Nachricht schreiben')
|
||||
end
|
||||
|
||||
def bootstrap_flash
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue