# Displaying records by week submitted

**URL:** <https://www.ruby-forum.com/t/displaying-records-by-week-submitted/116867>\
**Category:** Rails\
**Created:** [October 10, 2007, 4:39pm UTC](https://www.ruby-forum.com/t/displaying-records-by-week-submitted/116867 "2007-10-10T16:39:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [October 10, 2007, 4:39pm UTC](https://www.ruby-forum.com/t/displaying-records-by-week-submitted/116867/1 "2007-10-10T16:39:04Z")

</div>

I have a simple model structure. Projects have many notes.

For each of my project pages I would like to have a simple display like  
the following:

Project Name  
Week of MM/DD/YYYY  
Notes that fall under that week

So the output would be like the following:

Test Project (project.name)  
10/08/2007 (note.created\_on)

- Test (note.body)
- Test 2  
10/01/2007
- Test 3

Any thoughts on how I can craft an ActiveRecord :find to appropriately  
group my notes by date by project like this?

Thanks!

---

<div class="post-metadata">

**Author:** ![matt](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/a6a055/32.png) [@matt](https://www.ruby-forum.com/u/matt)\
**Post date:** [October 11, 2007, 8:58am UTC](https://www.ruby-forum.com/t/displaying-records-by-week-submitted/116867/2 "2007-10-11T08:58:46Z")

</div>

If all else fails, go to the source and learn the algorithm to convert a  
date to a week number:  
[http://www.amazon.com/Calendrical-Calculations-Millennium-Edward-Reingold/dp/0521777526](http://www.amazon.com/Calendrical-Calculations-Millennium-Edward-Reingold/dp/0521777526)

Matthew W. wrote:  
…

> Any thoughts on how I can craft an ActiveRecord :find to appropriately  
> group my notes by date by project like this?
> 
> Thanks!
