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.2.19 app/models/article.rb
sports_db-0.2.18 app/models/article.rb
sports_db-0.2.17 app/models/article.rb
sports_db-0.2.16 app/models/article.rb
sports_db-0.2.15 app/models/article.rb
sports_db-0.2.14 app/models/article.rb
sports_db-0.2.13 app/models/article.rb
sports_db-0.2.12 app/models/article.rb
sports_db-0.2.11 app/models/article.rb
sports_db-0.2.10 app/models/article.rb
sports_db-0.2.9 app/models/article.rb
sports_db-0.2.8 app/models/article.rb
sports_db-0.2.7 app/models/article.rb
sports_db-0.2.6 app/models/article.rb
sports_db-0.2.5 app/models/article.rb
sports_db-0.2.4 app/models/article.rb
sports_db-0.2.3 app/models/article.rb
sports_db-0.2.2 app/models/article.rb
sports_db-0.2.1 app/models/article.rb
sports_db-0.2 app/models/article.rb