The default current week is properly recalculated

This commit is contained in:
echarp 2015-12-22 00:29:41 +01:00
parent 0d63f2bb57
commit 0eeb265fc3

View File

@ -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]