diff options
Diffstat (limited to 'help/app/models')
-rw-r--r-- | help/app/models/ticket.rb | 6 | ||||
-rw-r--r-- | help/app/models/ticket_comment.rb | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb index 8a282b5..0f38bf4 100644 --- a/help/app/models/ticket.rb +++ b/help/app/models/ticket.rb @@ -28,7 +28,7 @@ class Ticket < CouchRest::Model::Base timestamps! - before_validation :set_code, :on => :create + before_validation :set_created_by, :set_code, :on => :create design do view :by_title @@ -37,7 +37,9 @@ class Ticket < CouchRest::Model::Base validates :email, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, :if => :email #email address is optional - #set created_by to be current_user + def set_created_by + self.created_by = User.current if User.current + end def is_creator_validated? !!created_by diff --git a/help/app/models/ticket_comment.rb b/help/app/models/ticket_comment.rb index 1e23136..6c2a792 100644 --- a/help/app/models/ticket_comment.rb +++ b/help/app/models/ticket_comment.rb @@ -26,8 +26,7 @@ class TicketComment < CouchRest::Model::Base #?? do we want this to be a base mo end def set_posted_by - #should be something like this, but current_user is not set yet - #self.posted_by = current_user if current_user + self.posted_by = User.current if User.current end end |