comparison app/models/paste.rb @ 428:9fc6b919369c

Whoops, broken the very basic thing Added test.
author nanaya <me@myconan.net>
date Sun, 15 Nov 2015 15:10:01 +0900
parents 9369ad2f2ce8
children 68eb23b52864
comparison
equal deleted inserted replaced
427:cbfb3a0a9d2e 428:9fc6b919369c
15 end 15 end
16 16
17 def self.safe_find(raw_id) 17 def self.safe_find(raw_id)
18 /\A(?<id>[0-9]+)(?:-(?<secret>[0-9a-f]+))?\z/ =~ raw_id.to_s 18 /\A(?<id>[0-9]+)(?:-(?<secret>[0-9a-f]+))?\z/ =~ raw_id.to_s
19 19
20 where(:secret => secret, :id => id) 20 where(:secret => secret, :id => id).take
21 end 21 end
22 22
23 def self.graceful_create(params) 23 def self.graceful_create(params)
24 paste = new(params) 24 paste = new(params)
25 fresh = true 25 fresh = true