Sha256: 142af74e90dab857cf6234bf44c21416057fa15b165ee018a75e4b8e382bbba7
Contents?: true
Size: 788 Bytes
Versions: 13
Compression:
Stored size: 788 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
13 entries across 13 versions & 1 rubygems