vapor
1
I have a long list of posts posted on different days and many posts
every day. I want them to arrange like following…
Date1
post1
post2
Date2
post3
post4
post5
How can I (say) group them to appear all posts of one date under their
related headng.
Because records have so many different days, it is confusing me… I need
some generic solution.
Thanks in advance.
vapor
3
hello,
check this post :
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/921051b1844a1ddd/93cfa15e7c907e00?lnk=gst&q=month#93cfa15e7c907e00
almost the same thing you want to do (except it is per monthes not per
days).
your query should look like it:
Post.find :all, :group => “DATE_FORMAT(date,‘%Y-%m-%d’)”
i’m not sure about DATE_FORMAT synthax, it is a mysql function but
psql user you must check it.
On Nov 19, 6:22 pm, “Vapor …” [email protected]