Fetch specific single occurrence?

6 views
Skip to first unread message

dwayne

unread,
Nov 30, 2009, 11:05:29 AM11/30/09
to RiCal
Hi guys:

I'm displaying my events in two styles, similar to iPhone's "list" and
"monthly" views. The former is just a running list of all occurrences
that displays all relevant information for each occurrence. The
monthly view (a standard monthly calendar layout) -- since space is at
a premium -- displays only the summary, which links to a #show page
that should display all details for that occurrence.

To keep things DRY, I'd like to use a partial to display the same info
the #show page that I do for each occurrence in list view.

So I already have this worked out for my list view. In the controller,
I retrieve a list of the occurrences, using Event#occurrences. In my
view, I then loop through the occurrences.

But when I link to a show page, I need an ID to send, and it can't
just be the ID of the event, it has to allow me to fetch that specific
occurrence. Because my users will only be setting up a maximum of one
recurrence per day, I could combine the event ID and the occurrence
date, then do something like:

Event.occurrences(:overlapping => [occurrence_date, occurrence_date])

But is that the preferred way of getting at a single, specific
occurrence, or is there a way to use an occurrence ID?

Thanks for any help!

Adam Williams

unread,
Nov 30, 2009, 9:58:25 PM11/30/09
to rica...@googlegroups.com, RiCal
I don't know the answer, per se, but I would caution you to consider
how a single recurrence per day should be found by people in different
time zones. For instance, if I, in Pacific time, create an event at
11:30PM and recur daily, then look for it in Eastern time at 1:00AM,
which instance do I get?

----
Adam on a phone
> --
>
> You received this message because you are subscribed to the Google
> Groups "RiCal" group.
> To post to this group, send email to rica...@googlegroups.com.
> To unsubscribe from this group, send email to rical_gem+...@googlegroups.com
> .
> For more options, visit this group at http://groups.google.com/group/rical_gem?hl=en
> .
>
>
Reply all
Reply to author
Forward
0 new messages