Correction rapide sur un soucis d'accès aux evt futurs
This commit is contained in:
parent
2b42a84e27
commit
9911dc0658
@ -12,7 +12,7 @@ class EventsController < ApplicationController
|
|||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.rss do
|
format.rss do
|
||||||
@events = @events.includes(:related_city).future params[:daylimit]
|
@events = @events.includes(:related_city).future_in params[:daylimit]
|
||||||
end
|
end
|
||||||
format.ics { @events = @events.last_year.order :id }
|
format.ics { @events = @events.last_year.order :id }
|
||||||
format.xml { @events = @events.includes(:related_region).order :id }
|
format.xml { @events = @events.includes(:related_region).order :id }
|
||||||
|
@ -23,9 +23,9 @@ class Event < ActiveRecord::Base
|
|||||||
where('end_time < ?', DateTime.now).order start_time: :desc
|
where('end_time < ?', DateTime.now).order start_time: :desc
|
||||||
end)
|
end)
|
||||||
scope :future, (lambda do
|
scope :future, (lambda do
|
||||||
where('end_time >= ?', DateTime.now).order start_time: :asc
|
where('? <= end_time', DateTime.now).order start_time: :asc
|
||||||
end)
|
end)
|
||||||
scope :future, (lambda do |days|
|
scope :future_in, (lambda do |days|
|
||||||
days ||= '30'
|
days ||= '30'
|
||||||
where('? <= start_time and end_time <= ?',
|
where('? <= start_time and end_time <= ?',
|
||||||
DateTime.now, days.to_i.days.from_now)
|
DateTime.now, days.to_i.days.from_now)
|
||||||
|
Loading…
Reference in New Issue
Block a user