Pluralise birthdays_controller.

This commit is contained in:
gchq 2011-06-03 21:25:07 +02:00
parent b33d0dc673
commit 0ed837b18a

View file

@ -1,15 +0,0 @@
class BirthdayController < ApplicationController
def index
n = Date.today
e = Date.today + 7.days
# two cases here: now + 7days iis still the same month. or it's not.
if n.month == e.month
@birthdays = Contact.where("birth_month = ? AND birth_day <= ? AND birth_day >= ?",
e.month, e.day, n.day)
else
@birthdays = Contact.where("(birth_month = ? AND birth_day <= ?) OR (birth_month = ? AND birth_day >= ?)",
e.month, e.day, n.month, n.day)
end
end
end