Module: PagesCore::PageModel::DatedPage::ClassMethods
- Defined in:
- app/models/concerns/pages_core/page_model/dated_page.rb
Instance Method Summary collapse
Instance Method Details
#count_by_month ⇒ Object
18 19 20 |
# File 'app/models/concerns/pages_core/page_model/dated_page.rb', line 18 def count_by_month connection.select_all(count_by_month_query).map(&:symbolize_keys) end |
#in_year(year) ⇒ Object
22 23 24 25 26 27 |
# File 'app/models/concerns/pages_core/page_model/dated_page.rb', line 22 def in_year(year) time = Date.new(year.to_i).to_time where("ends_at >= ? AND starts_at <= ?", time.beginning_of_year, time.end_of_year) end |
#in_year_and_month(year, month) ⇒ Object
29 30 31 32 33 34 |
# File 'app/models/concerns/pages_core/page_model/dated_page.rb', line 29 def in_year_and_month(year, month) time = Date.new(year.to_i, month.to_i).to_time where("ends_at >= ? AND starts_at <= ?", time.beginning_of_month, time.end_of_month) end |