Permalink
Browse files

Display only active events

  • Loading branch information...
1 parent b2908a6 commit 2adfca2eac9534335c69e58f74b5283e6ecd8ad5 @ionmx ionmx committed Jul 6, 2012
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/controllers/post_events_controller.rb
@@ -2,7 +2,7 @@ class PostEventsController < ApplicationController
before_filter :auth_required
respond_to :html, :json
def upcoming
- @events = PostEvent.where("(start_date >= :date) OR (end_date >= :date)", {:date => Time.now.strftime("%Y-%m-%d")}).limit(10).order(:start_date)
+ @events = PostEvent.includes(:post).where("posts.status = :status AND ((start_date >= :date) OR (end_date >= :date))", {:status => Post::ACTIVE, :date => Time.now.strftime("%Y-%m-%d")}).limit(10).order(:start_date)
if @events.count > 0
render :layout => false
else

0 comments on commit 2adfca2

Please sign in to comment.