Class: LatestArticles
- Inherits:
-
Noodall::Component
- Object
- Noodall::Component
- LatestArticles
- Defined in:
- app/models/latest_articles.rb
Instance Method Summary collapse
-
#articles ⇒ Object
Returns a filtered list of latest articles.
- #categories ⇒ Object
Instance Method Details
#articles ⇒ Object
Returns a filtered list of latest articles
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/models/latest_articles.rb', line 11 def articles return [] if article_list.nil? query = { categories: category, order: ['published_at DESC','created_at DESC'] } # Remove any filters that are set to "All" query.reject! {|key, value| value == "All" || value.blank? } article_list.children.published.limit(3).all(query) end |
#categories ⇒ Object
24 25 26 |
# File 'app/models/latest_articles.rb', line 24 def categories Article.all_categories end |