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|
|
respond_to do |format|
|
||||||
format.html
|
format.html
|
||||||
format.rss do
|
format.rss do
|
||||||
@events = @events.future_30.includes :related_city
|
@events = @events.includes(:related_city).future params[:daylimit]
|
||||||
@events = @events.limit params[:daylimit] if 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 }
|
||||||
|
@ -25,8 +25,10 @@ class Event < ActiveRecord::Base
|
|||||||
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_30, (lambda do
|
scope :future, (lambda do |days|
|
||||||
where('start_time >= ? and end_time <= ?', DateTime.now, 30.days.from_now)
|
days ||= '30'
|
||||||
|
where('? <= start_time and end_time <= ?',
|
||||||
|
DateTime.now, days.to_i.days.from_now)
|
||||||
.order :start_time
|
.order :start_time
|
||||||
end)
|
end)
|
||||||
scope :year, (lambda do |year|
|
scope :year, (lambda do |year|
|
||||||
|
Loading…
Reference in New Issue
Block a user