Class: SiteBlog::Article
- Inherits:
-
ApplicationRecord
- Object
- ActiveRecord::Base
- ApplicationRecord
- SiteBlog::Article
- Includes:
- PgSearch::Model
- Defined in:
- app/models/site_blog/article.rb
Class Method Summary collapse
Class Method Details
.main ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/models/site_blog/article.rb', line 46 def self.main if self.archived(false).where(main: true).exists? res = self.archived(false).where(main: true).last else res = self.order('created_at DESC').first end res end |