comparison app/models/paste.rb @ 2:42de15334db1

Added the pastes.
author Edho Arief <edho@myconan.net>
date Sun, 26 Aug 2012 11:28:23 -0700
parents
children 032686a0c995
comparison
equal deleted inserted replaced
1:49c0949ee47e 2:42de15334db1
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