The default current week is properly recalculated
This commit is contained in:
parent
0d63f2bb57
commit
0eeb265fc3
@ -2,10 +2,12 @@
|
|||||||
class DigestsController < ApplicationController
|
class DigestsController < ApplicationController
|
||||||
has_scope :moderated, default: nil, allow_blank: true
|
has_scope :moderated, default: nil, allow_blank: true
|
||||||
has_scope :region, :locality, :tag
|
has_scope :region, :locality, :tag
|
||||||
has_scope :period, allow_blank: true,
|
has_scope :period, allow_blank: true, type: :hash, using: [:year, :week],
|
||||||
type: :hash, using: [:year, :week],
|
default: (
|
||||||
default: { year: (Time.zone.today + 7.days).year,
|
lambda do
|
||||||
week: (Time.zone.today + 7.days).cweek }
|
{ 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_week, if: -> { params[:period] }
|
||||||
before_action :set_events, only: [:show]
|
before_action :set_events, only: [:show]
|
||||||
|
Loading…
Reference in New Issue
Block a user