changeset 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 e021f4e76269
files app/models/paste.rb
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/app/models/paste.rb	Wed May 15 14:10:35 2013 +0900
+++ b/app/models/paste.rb	Wed May 15 14:31:20 2013 +0900
@@ -35,7 +35,11 @@
   end
 
   def set_paste_secret
-    self.secret = SecureRandom.hex(4) if self.is_private
+    self.secret = SecureRandom.hex(4) if self.is_private?
+  end
+
+  def is_private?
+    self.is_private == "1"
   end
 
   def convert_newlines