It depends how it' stored in the Database.
If it is stored in a string of format 'MM/DD', then I'd probably do
something like this:
def find_birthdays
mmdd = Date.today.to_s.gsub('-', '/')[5..9]
@birthdays = Birthday.find :all, :conditions => ['b_date like ?',
mmdd]
end
Just make sure the month and day are always two digits.
And there might be a smarter way to do it than using gsub, but I don't
know it off-hand.
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---