Howdy,
I'm attempting to layout my routes for adding calendaring to my app
and would like some advice. It just feels like I'm heading down the
wrong path.
What I have is a restful Calendars controller. Each Calendar instance
defines both what is shown and how. Here's some sample urls:
/calendars/1 # all appointments day view
/calendars/2 # all appointments week view
/calendars/3 # all appointments month view
/calendars/4 # all activities day view
I also have the controller working under other controllers:
/pets/21/calendars/3 # Fido's appointments month view
/groomers/4/calendars/1 # Groomer Bob's appointments day view
So basic router pattern is:
resources calendars
resources pets do
resources calendars
end
Well and good. Then I added navigation previous and next actions
to the controller with these routes:
match('/calendars/:id/previous')
.to(:controller => 'calendars', :action => 'previous')
.name(:calendar_previous)
match('/calendars/:id/next')
.to(:controller => 'calendars', :action => 'next')
.name(:calendar_next)
The problem is that these do not support having a parent. I.e.
/calendars/3/next
works but:
/pets/21/calendars/3/next
does not work.
So it looks like my real question is how should I add action routes to
rest resources?
Also while trying to find the answer I've notice that I've never seen
passing a param like:
/pets/21/calendars/3?nav=next
I'm guessing it's considered bad form to mix params with rest routes.
Thank you,
Roy
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"merb" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/merb?hl=en
-~----------~----~----~----~------~----~------~--~---