Class: Report

Inherits:
ApplicationRecord show all
Extended by:
Enumerize
Defined in:
app/models/report.rb

Overview

typed: ignore

Schema Information

Table name: reports

id            :bigint           not null, primary key
data          :integer
day           :integer
month         :integer
name          :string(191)
year          :integer
created_at    :datetime         not null
updated_at    :datetime         not null
restaurant_id :bigint

Indexes

index_reports_on_day            (day)
index_reports_on_month          (month)
index_reports_on_name           (name)
index_reports_on_restaurant_id  (restaurant_id)
index_reports_on_year           (year)
reports_report_date             (report_date)
unique_reports                  (restaurant_id,name,day,month,year) UNIQUE

Class Method Summary collapse

Methods inherited from ApplicationRecord

sync_carrierwave_url

Class Method Details

.cached_all_cache_keyObject



84
85
86
87
88
# File 'app/models/report.rb', line 84

def self.cached_all_cache_key
  Rails.cache.fetch('report_cache_key', expires_in: 5.minutes) do
    Report.last&.cache_key.presence || Time.zone.now
  end
end