Class: Tag
Instance Method Summary
collapse
#records
#serialize, #to_serializable
#errors_on
Instance Method Details
#feed_articles ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/app/models/tag.rb', line 24
def feed_articles
Article.find :all,
:joins => :taggings,
:order => 'articles.created_at DESC',
:conditions => ['taggings.tag_id=?', self.id],
:limit => Hubbub::Config[:items_per_feed] || 5
end
|
#page_articles(page = nil) ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/app/models/tag.rb', line 16
def page_articles page=nil
Article.paginate :page => page,
:joins => :taggings,
:order => 'articles.created_at DESC',
:conditions => ['taggings.tag_id=?', self.id],
:per_page => Hubbub::Config[:items_per_page] || 10
end
|
12
13
14
|
# File 'lib/app/models/tag.rb', line 12
def to_param
self.slug
end
|
8
9
10
|
# File 'lib/app/models/tag.rb', line 8
def weight
Tagging.count :conditions => "tag_id = #{self.id}"
end
|