Mercurial > zeropaste
comparison app/models/paste.rb @ 290:d68cb68da802
Use hash rocket.
author | edogawaconan <me@myconan.net> |
---|---|
date | Wed, 16 Oct 2013 13:32:53 +0900 |
parents | 0bf1d6f75baa |
children | 61f7f258a6fb |
comparison
equal
deleted
inserted
replaced
289:1b302d092e98 | 290:d68cb68da802 |
---|---|
14 | 14 |
15 def self.safe_find(raw_id) | 15 def self.safe_find(raw_id) |
16 id, secret = raw_id.to_s.split("-") | 16 id, secret = raw_id.to_s.split("-") |
17 return unless id.to_i.to_s == id | 17 return unless id.to_i.to_s == id |
18 begin | 18 begin |
19 self.where(secret: secret).find(id) | 19 self.where(:secret => secret).find(id) |
20 rescue ActiveRecord::RecordNotFound | 20 rescue ActiveRecord::RecordNotFound |
21 nil | 21 nil |
22 end | 22 end |
23 end | 23 end |
24 | 24 |