Mercurial > zeropaste
annotate app/models/paste.rb @ 7:3a1f6c2e195d
Added raw paste view.
author | Edho Arief <edho@myconan.net> |
---|---|
date | Sun, 26 Aug 2012 11:39:07 -0700 |
parents | 42de15334db1 |
children | 032686a0c995 |
rev | line source |
---|---|
2 | 1 class Paste < ActiveRecord::Base |
2 attr_accessible :paste | |
3 before_validation :set_paste_hash | |
4 validates :paste, :paste_hash, :ip, :presence => true | |
5 validates :paste, :length => { :maximum => 1_000_000 } | |
6 | |
7 def set_paste_hash | |
8 self.paste_hash = Digest::SHA512.hexdigest(paste) | |
9 end | |
10 end |