summaryrefslogtreecommitdiff
path: root/help/app/models/ticket.rb
diff options
context:
space:
mode:
Diffstat (limited to 'help/app/models/ticket.rb')
-rw-r--r--help/app/models/ticket.rb15
1 files changed, 11 insertions, 4 deletions
diff --git a/help/app/models/ticket.rb b/help/app/models/ticket.rb
index 784d7ef..355ae02 100644
--- a/help/app/models/ticket.rb
+++ b/help/app/models/ticket.rb
@@ -29,7 +29,8 @@ class Ticket < CouchRest::Model::Base
timestamps!
- before_validation :set_created_by, :set_code, :on => :create
+ #before_validation :set_created_by, :set_code, :set_email, :on => :create
+ before_validation :set_code, :set_email, :on => :create
design do
view :by_title
@@ -38,9 +39,10 @@ class Ticket < CouchRest::Model::Base
validates :email, :format => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/, :if => :email #email address is optional
- def set_created_by
- self.created_by = User.current if User.current
- end
+ #TODO:
+ #def set_created_by
+ # self.created_by = User.current if User.current
+ #end
def is_creator_validated?
!!created_by
@@ -51,6 +53,11 @@ class Ticket < CouchRest::Model::Base
self.code = SecureRandom.hex(8) if !is_creator_validated?
end
+
+ def set_email
+ #self.email = current users email if is_creator_validated?
+ end
+
def close
self.is_open = false
save