diff app/models/paste.rb @ 376:02903dc8214d

Fix code styles. - remove return and self keyword and use find_each instead of each.
author nanaya <me@myconan.net>
date Sat, 06 Jun 2015 22:34:36 +0900
parents 6e3e1e7b0212
children 4e6afc8140fb
line wrap: on
line diff
--- a/app/models/paste.rb	Sat Jun 06 22:22:41 2015 +0900
+++ b/app/models/paste.rb	Sat Jun 06 22:34:36 2015 +0900
@@ -23,18 +23,18 @@
   end
 
   def self.graceful_create(params)
-    paste = self.new(params)
+    paste = new(params)
     fresh = true
     created = true
 
     begin
       created = paste.save
     rescue ActiveRecord::RecordNotUnique
-      paste = self.find_by(:ip => paste.ip, :paste_hash => paste.paste_hash)
+      paste = find_by(:ip => paste.ip, :paste_hash => paste.paste_hash)
       fresh = false
     end
 
-    return [created, paste, fresh]
+    [created, paste, fresh]
   end
 
   def paste_gzip=(paste)
@@ -85,7 +85,7 @@
 
   def self.fix_all
     stats = Hash.new(0)
-    all.each do |p|
+    all.find_each do |p|
       p.save
       stats[:count] += 1
       stats[:private] += 1 if p.secret