diff options
author | jessib <jessib@riseup.net> | 2012-10-02 15:29:28 -0700 |
---|---|---|
committer | jessib <jessib@riseup.net> | 2012-10-02 15:29:28 -0700 |
commit | 5bc3eae400754dda90a45d6953a02a069a1c0285 (patch) | |
tree | 9391b3bb5c3f0847746b52805c61ea346486301a /help/app/models/ticket.rb | |
parent | 61d73ac517ccbcc7ca8892010ef89e861052807f (diff) |
Some more tweaks to help ticket models. Still want to tweak current_user access from users engine.
Diffstat (limited to 'help/app/models/ticket.rb')
-rw-r--r-- | help/app/models/ticket.rb | 6 |
1 files changed, 4 insertions, 2 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 |