comparison app/models/paste.rb @ 255:a894d7696b7e

More useful return of Paste.fix_all.
author edogawaconan <me@myconan.net>
date Mon, 14 Oct 2013 17:49:52 +0000
parents 9aa67da381b0
children 6cca1ab53337
comparison
equal deleted inserted replaced
254:bcca41003e84 255:a894d7696b7e
50 ip_post_recent_count = self.class.where(:ip => self.ip).where('created_at > ?', Time.now - 1.hour).count 50 ip_post_recent_count = self.class.where(:ip => self.ip).where('created_at > ?', Time.now - 1.hour).count
51 errors.add :base, :limit if ip_post_recent_count > 100 51 errors.add :base, :limit if ip_post_recent_count > 100
52 end 52 end
53 53
54 def self.fix_all 54 def self.fix_all
55 stats = Hash.new(0)
55 self.all.each do |p| 56 self.all.each do |p|
56 p.save 57 p.save
58 stats[:count] += 1
59 stats[:private] += 1 if p.secret
57 end 60 end
61 return stats
58 end 62 end
59 end 63 end