CURDATE is a MySQL function. Heroku uses PostgreSQL whose current date
function is CURRENT_DATE.

In Rails, it's not recommended to use raw SQL if possible. This way,
it doesn't matter what database you are using, it just works. For
example, in your case, you can add a named scope to your Announcement
model:

named_scope :active, :conditions => [ "expires_on > ?",
Date.today], :limit => 2

Something like that. Then you can just call Announcement.active and it
will return 2 announcements with expires_on after today.

Actually, I'm kinda concerned that you have 2 columns for the
announcement to determine if its active or not. I mean is it possible
to have active column to be true but expires_on to be before the
current date? Why not just use expires_on?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Heroku" 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/heroku?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to