Class: Cmtool::News

Inherits:
Object
  • Object
show all
Includes:
Paperclip::Glue, SimplyStored::Couch
Defined in:
app/models/cmtool/news.rb

Class Method Summary collapse

Class Method Details

.active(options = {till: Date.today}) ⇒ Object



24
25
26
# File 'app/models/cmtool/news.rb', line 24

def self.active(options = {till: Date.today})
  find_all_by_active(true, options)
end

.find_all_by_active(active, options = {till: Date.today}) ⇒ Object



28
29
30
# File 'app/models/cmtool/news.rb', line 28

def self.find_all_by_active(active, options = {till: Date.today})
  database.view(by_active(startkey: [active, options[:till].strftime('%Y-%m-%d')], endkey: [active], descending: true))
end