Created
December 10, 2011 17:23
-
-
Save resure/1455662 to your computer and use it in GitHub Desktop.
digest_methods.rb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module DigestMethods | |
def self.included(klass) | |
end | |
def generate_digest | |
require 'digest/sha2' | |
digest = Digest::SHA1.hexdigest(self.body) | |
self.update_attribute(:sha, digest) | |
end | |
def digest | |
self.sha | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment