Created
May 31, 2009 23:58
-
-
Save pelle/121088 to your computer and use it in GitHub Desktop.
Embedding TimeCert in your rails app
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
require 'digest/sha1' | |
class Article < ActiveRecord::Base | |
before_save :update_digest | |
def full_text | |
"#{title}\n\n#{body}" | |
end | |
protected | |
def update_digest | |
self.digest=Digest::SHA1.hexdigest(self.full_text) | |
end | |
end |
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 TimecertHelper | |
def display_timecert_for(article) | |
"<div class=\"timecert\"><iframe src=\"https://timecert.org/#{article.digest}.iframe\" width=\"500\" height=\"30\"></iframe></div>" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment