Correction rapide sur un soucis d'accès aux evt futurs

This commit is contained in:
echarp 2014-08-17 20:47:35 +02:00
parent 2b42a84e27
commit 9911dc0658
2 changed files with 3 additions and 3 deletions

View File

@ -12,7 +12,7 @@ class EventsController < ApplicationController
respond_to do |format|
format.html
format.rss do
@events = @events.includes(:related_city).future params[:daylimit]
@events = @events.includes(:related_city).future_in params[:daylimit]
end
format.ics { @events = @events.last_year.order :id }
format.xml { @events = @events.includes(:related_region).order :id }

View File

@ -23,9 +23,9 @@ class Event < ActiveRecord::Base
where('end_time < ?', DateTime.now).order start_time: :desc
end)
scope :future, (lambda do
where('end_time >= ?', DateTime.now).order start_time: :asc
where('? <= end_time', DateTime.now).order start_time: :asc
end)
scope :future, (lambda do |days|
scope :future_in, (lambda do |days|
days ||= '30'
where('? <= start_time and end_time <= ?',
DateTime.now, days.to_i.days.from_now)