Mercurial > zeropaste
comparison app/models/paste.rb @ 230:1c750d3cde1b
Correct way to test is_private flag.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Wed, 15 May 2013 14:31:20 +0900 |
parents | 388504e43bcf |
children | 9aa67da381b0 |
comparison
equal
deleted
inserted
replaced
229:388504e43bcf | 230:1c750d3cde1b |
---|---|
33 def set_paste_key | 33 def set_paste_key |
34 self.key ||= SecureRandom.hex(4) | 34 self.key ||= SecureRandom.hex(4) |
35 end | 35 end |
36 | 36 |
37 def set_paste_secret | 37 def set_paste_secret |
38 self.secret = SecureRandom.hex(4) if self.is_private | 38 self.secret = SecureRandom.hex(4) if self.is_private? |
39 end | |
40 | |
41 def is_private? | |
42 self.is_private == "1" | |
39 end | 43 end |
40 | 44 |
41 def convert_newlines | 45 def convert_newlines |
42 self.paste = self.paste.to_s.gsub("\r\n", "\n").gsub("\r", "\n") | 46 self.paste = self.paste.to_s.gsub("\r\n", "\n").gsub("\r", "\n") |
43 end | 47 end |