Rails: Queriyng entries with conditions

Hi,

I'm writing a rails application where I query entries from a table which have a date field. I want to have all entries after a specific date. Rails maps everything very well, except if I use conditions:

Receipt.find_all ("date >= '2005-02-03'", "date ASC")

But I didn't find any method to convert a date to convert a time object to a usable sql string.

Currently I'm using the following code:

class Time
   def to_sql
     return "#%.04i-%.02i-%.02i" % [self.year, self.month, self.day]
   end
end

I think it's ok, but I don't want to use it if there's a rails helper for something like this.

Malte

Malte Harder wrote:

Receipt.find_all ("date >= '2005-02-03'", "date ASC")

But I didn't find any method to convert a date to convert a time

object

to a usable sql string.

You can try this:

Receipt.find_all [ "date >= ?", your_date ], "date ASC"

Rgds
Dema

Hint: You can get a quicker response if you use the Rails list or the
Rails irc channel for these kind of questions.