Le paramètre daylimit est mieux pris en compte pour les flux rss
This commit is contained in:
parent
052836eae9
commit
849066c0e5
@ -12,8 +12,7 @@ class EventsController < ApplicationController
|
||||
respond_to do |format|
|
||||
format.html
|
||||
format.rss do
|
||||
@events = @events.future_30.includes :related_city
|
||||
@events = @events.limit params[:daylimit] if params[:daylimit]
|
||||
@events = @events.includes(:related_city).future params[:daylimit]
|
||||
end
|
||||
format.ics { @events = @events.last_year.order :id }
|
||||
format.xml { @events = @events.includes(:related_region).order :id }
|
||||
|
@ -25,8 +25,10 @@ class Event < ActiveRecord::Base
|
||||
scope :future, (lambda do
|
||||
where('end_time >= ?', DateTime.now).order start_time: :asc
|
||||
end)
|
||||
scope :future_30, (lambda do
|
||||
where('start_time >= ? and end_time <= ?', DateTime.now, 30.days.from_now)
|
||||
scope :future, (lambda do |days|
|
||||
days ||= '30'
|
||||
where('? <= start_time and end_time <= ?',
|
||||
DateTime.now, days.to_i.days.from_now)
|
||||
.order :start_time
|
||||
end)
|
||||
scope :year, (lambda do |year|
|
||||
|
Loading…
Reference in New Issue
Block a user