From 0b23df922336289b6f8062653b4d3e852ed927ec Mon Sep 17 00:00:00 2001 From: Azul Date: Mon, 3 Dec 2012 08:55:49 +0100 Subject: make tests pass on an empty db --- help/app/controllers/tickets_controller.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'help/app') diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index 4c7415b..b5f3a63 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -14,7 +14,7 @@ class TicketsController < ApplicationController @ticket.created_by = current_user.id @ticket.email = current_user.email if current_user.email @ticket.comments.last.posted_by = current_user.id - else + else @ticket.comments.last.posted_by = nil #hacky, but protecting this attribute doesn't work right, so this should make sure it isn't set. end @@ -36,11 +36,11 @@ class TicketsController < ApplicationController # @ticket.comments.build # build ticket comments? end - + def update @ticket = Ticket.find(params[:id]) @ticket.attributes = params[:ticket] - + @ticket.comments.last.posted_by = (current_user ? current_user.id : nil) #protecting posted_by isn't working, so this should protect it. if @ticket.save @@ -60,7 +60,7 @@ class TicketsController < ApplicationController end private - + # not using now, as we are using comment_attributes= from the Ticket model =begin def add_comment -- cgit v1.2.3