summaryrefslogtreecommitdiff
path: root/help/app/models
diff options
context:
space:
mode:
authorjessib <jessib@riseup.net>2012-10-10 15:52:08 -0700
committerjessib <jessib@riseup.net>2012-10-10 15:52:08 -0700
commitcf9ed38ab1840092352efdbb71bfeb5bc3b9f9d5 (patch)
tree10bfad997861e6a3c49fca3f5c2713d491eff7ee /help/app/models
parent0bdfbdb57ab7c29d0d87dc1a44b17eb32f98439b (diff)
Some tweaks to get server-side validation working when adding the embedded ticket comment to a new ticket.
Diffstat (limited to 'help/app/models')
-rw-r--r--help/app/models/ticket.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb
index 8cec0df..e829a5f 100644
--- a/help/app/models/ticket.rb
+++ b/help/app/models/ticket.rb
@@ -29,8 +29,6 @@ class Ticket < CouchRest::Model::Base
timestamps!
- #accepts_nested_attributes_for :ticketcomments #??
-
#before_validation :set_created_by, :set_code, :set_email, :on => :create
before_validation :set_code, :set_email, :on => :create
@@ -75,9 +73,12 @@ class Ticket < CouchRest::Model::Base
save
end
- #probably not useful, but trying it:
- def ticket_comment_attributes=(attributes)
- @ticket_comment = TicketComment.new(attributes)
+ def comments_attributes=(attributes)
+ comment = TicketComment.new(attributes.values.first) #TicketComment.new(attributes)
+ comment.posted_by = User.current_test.id if User.current_test
+ comment.posted_at = Time.now
+ comments << comment
+
end
=begin