The default current week is properly recalculated

recurrent
echarp 7 years ago
parent 0d63f2bb57
commit 0eeb265fc3
  1. 10
      app/controllers/digests_controller.rb

@ -2,10 +2,12 @@
class DigestsController < ApplicationController
has_scope :moderated, default: nil, allow_blank: true
has_scope :region, :locality, :tag
has_scope :period, allow_blank: true,
type: :hash, using: [:year, :week],
default: { year: (Time.zone.today + 7.days).year,
week: (Time.zone.today + 7.days).cweek }
has_scope :period, allow_blank: true, type: :hash, using: [:year, :week],
default: (
lambda do
{ year: (Time.zone.today + 7.days).year,
week: (Time.zone.today + 7.days).cweek }
end)
before_action :set_week, if: -> { params[:period] }
before_action :set_events, only: [:show]

Loading…
Cancel
Save