Sha256: 80286e5a93489e92a0ee4debc1a95e142c2ba1688dbcd982f3200f025ad0aca4

Contents?: true

Size: 720 Bytes

Versions: 33

Compression:

Stored size: 720 Bytes

Contents

require 'digest/md5'

class Article < ActiveRecord::Base
    belongs_to :player
    belongs_to :game
    has_and_belongs_to_many :news_filters, :join_table => "articles_news_filters"
    
    def self.find_by_category(category)
        Article.find(:all, :conditions => ['category = ?', category], :order => 'published_at DESC')
    end
    
    def set_digest
        str = (self["published_at"].nil?) ? self["title"] : (self["title"] + self["published_at"].to_s)
        self["digest"] = Digest::SHA1.hexdigest(str)
    end
    
    def is_article?
        true
    end
    
    def is_video? 
        false
    end
        
    def is_twitter?
        false
    end
    
    def sn_url
    	self["link"]
    end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
sports_db-0.0.13 app/models/article.rb
sports_db-0.1.3 app/models/article.rb
sports_db-0.1.2 app/models/article.rb
sports_db-0.1.1 app/models/article.rb
sports_db-0.1.0 app/models/article.rb
sports_db-0.0.9 app/models/article.rb
sports_db-0.0.8 app/models/article.rb
sports_db-0.0.7 app/models/article.rb
sports_db-0.0.6 app/models/article.rb
sports_db-0.0.5 app/models/article.rb
sports_db-0.0.4 app/models/article.rb
sports_db-0.0.3 app/models/article.rb
sports_db-0.0.2 app/models/article.rb