Skip to content

Instantly share code, notes, and snippets.

@mikebaldry
Created September 21, 2012 09:34
Show Gist options
  • Select an option

  • Save mikebaldry/3760603 to your computer and use it in GitHub Desktop.

Select an option

Save mikebaldry/3760603 to your computer and use it in GitHub Desktop.
scope :dashboard_active, includes(:media_plan_line)
.where(["((media_plan_lines.start_at <= ? AND media_plan_lines.end_at >= ?)
OR
(DATEDIFF(CURDATE(), media_plan_lines.end_at) <= 10)) AND NOT media_plan_lines.status = ?",
Date.today, Date.today, "pipeline"])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment