# Grouping dates in behaviour

**URL:** <https://www.ruby-forum.com/t/grouping-dates-in-behaviour/66132>\
**Category:** Radiant CMS\
**Created:** [August 23, 2006, 3:19pm UTC](https://www.ruby-forum.com/t/grouping-dates-in-behaviour/66132 "2006-08-23T15:19:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 23, 2006, 3:19pm UTC](https://www.ruby-forum.com/t/grouping-dates-in-behaviour/66132/1 "2006-08-23T15:19:24Z")

</div>

I’m trying to make a behaviour that takes some events with dates from  
a ‘showings’ table and puts them on the page.

For events on the same day I only want to show the date once, like this:

Monday  
some event  
some other event  
and yet another event

Tuesday  
You get the idea

I’m not sure how to do this…

The behaviour looks like this:

tag “showings:coming” do |tag| content = ‘’  
@showings = Showing.all

@showings.each do |showing|  
tag.locals.showing = showing  
content \<\< tag.expand  
end  
content  
end

tag “showing” do |tag|  
tag.expand  
end

tag “showing:date” do |tag|  
tag.locals.showing.start.strftime("%m/%d/%Y")  
end

–  
Jeroen

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [August 23, 2006, 5:57pm UTC](https://www.ruby-forum.com/t/grouping-dates-in-behaviour/66132/2 "2006-08-23T17:57:50Z")

</div>

jeroen janssen wrote:

> Tuesday  
> You get the idea

Have a look at the children:each:header tag in page\_context.rb:

[http://dev.radiantcms.org/radiant/browser/trunk/radiant/app/models/page\_context.rb](http://dev.radiantcms.org/radiant/browser/trunk/radiant/app/models/page_context.rb)

You could easily create something similar for your “showings” tags.

–  
John L.  
[http://wiseheartdesign.com](http://wiseheartdesign.com)
