Sha256: 8f8f102b8095cc1d9bd0e68c5d31924332b895db9bf29851c61c0a666e85dafe
Contents?: true
Size: 807 Bytes
Versions: 21
Compression:
Stored size: 807 Bytes
Contents
require 'digest/md5' class Media < ActiveRecord::Base # Create a hash based on publication time and title that should uniquely identify # this publication of the document. before_save :before_save_method def before_save_method if (self["title"].nil?) raise "This is an issue.... there's no title" Rails.logger.warn("Found video with no title") return false end str = (self["published_at"].nil?) ? self["title"] : (self["title"] + self["published_at"].to_s) self["digest"] = Digest::SHA1.hexdigest(str) end def is_video? true end def is_twitter? false end def is_article? false end def thumbnail_url self.thumb_image_url end end
Version data entries
21 entries across 21 versions & 1 rubygems