comparison app/models/paste.rb @ 377:4e6afc8140fb

Use Time.zone as per rubocop recommendation.
author nanaya <me@myconan.net>
date Sat, 06 Jun 2015 22:35:21 +0900
parents 02903dc8214d
children 2ad092e60975
comparison
equal deleted inserted replaced
376:02903dc8214d 377:4e6afc8140fb
77 def convert_newlines 77 def convert_newlines
78 self.paste = paste.to_s.gsub("\r\n", "\n").gsub("\r", "\n") 78 self.paste = paste.to_s.gsub("\r\n", "\n").gsub("\r", "\n")
79 end 79 end
80 80
81 def paste_limit 81 def paste_limit
82 ip_post_recent_count = self.class.where(:ip => ip).where("created_at > ?", Time.now - 1.hour).count 82 ip_post_recent_count = self.class.where(:ip => ip).where("created_at > ?", Time.zone.now - 1.hour).count
83 errors.add :base, :limit if ip_post_recent_count > 100 83 errors.add :base, :limit if ip_post_recent_count > 100
84 end 84 end
85 85
86 def self.fix_all 86 def self.fix_all
87 stats = Hash.new(0) 87 stats = Hash.new(0)