From 6eaecdd10be3974871583e1fed8c5d4e7e307bd8 Mon Sep 17 00:00:00 2001 From: jessib Date: Mon, 29 Oct 2012 15:08:21 -0700 Subject: Just some comments --- help/app/controllers/tickets_controller.rb | 1 + help/app/models/ticket.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/help/app/controllers/tickets_controller.rb b/help/app/controllers/tickets_controller.rb index 4c7415b..d2c9643 100644 --- a/help/app/controllers/tickets_controller.rb +++ b/help/app/controllers/tickets_controller.rb @@ -41,6 +41,7 @@ class TicketsController < ApplicationController @ticket = Ticket.find(params[:id]) @ticket.attributes = params[:ticket] + # what if there is an update and no new comment? Confirm that there is a new comment to update posted_by @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 diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb index f38fed2..15d4d3d 100644 --- a/help/app/models/ticket.rb +++ b/help/app/models/ticket.rb @@ -80,6 +80,7 @@ class Ticket < CouchRest::Model::Base comment = TicketComment.new(attributes.values.first) #TicketComment.new(attributes) #comment.posted_by = User.current.id if User.current #we want to avoid User.current, and current_user won't work here. instead will set in tickets_controller + # what about: comment.posted_by = self.updated_by (will need to add ticket.updated_by) comment.posted_at = Time.now comments << comment -- cgit v1.2.3