Count in a date field

Hi all
We have a table that has a datetime field (created_at) that we have to
summarize based on it.

For instance, we have to count all posts grouped by created_at field.

Our first approach is:

self.count(:all,
:conditions => some_condition,
:group => :created_at)

This lead to an array that have the following structure:

[
[ created_at field ] , [number of posts in that date],
[ another date ] , […],
]

But, as the created_at field is datetime, the group doesn’t group
anything as this field saves the date and time with microseconds.
What we need is to group by date only.

Our next approach was:

self.count(:all,
:conditions => some_condition,
:group => “DATE(‘CREATED_AT’)”)

This works on SQL but in Rails, it returns an array like this:
[ [nil, total number of posts] ]

I think that Rails tries to find the group field and as the field is
between the DATE function, it doesn’t find it and returns nil.

Does anyone have a solution?

Best regards

Marcos