comparison app/models/paste.rb @ 316:61f7f258a6fb

Move from-gzip paste parsing to model.
author edogawaconan <me@myconan.net>
date Sat, 05 Apr 2014 23:23:25 +0900
parents d68cb68da802
children 96631607785f
comparison
equal deleted inserted replaced
315:325fcf388442 316:61f7f258a6fb
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
24
25 def paste_gzip=(paste)
26 self.paste = ActiveSupport::Gzip.decompress paste
27 end
28
29 def paste_gzip_base64=(paste)
30 self.paste_gzip = Base64.decode64(paste)
23 end 31 end
24 32
25 def safe_destroy(param_key) 33 def safe_destroy(param_key)
26 if key == param_key 34 if key == param_key
27 destroy 35 destroy