I'm creating a new application and I want to setup my urls to that
similar of rails and django. In my previous CB apps, I modified the
standard route to pass multiple variables like so...
this worked out, however I'd like a more meaningful route/resource
has anyone done something similar to this? I'm not sure if my
"subaction" would be another event handler or just another action
within my handler... Not sure, just throwing some ideas, but at some
points in my app I need to be able to pass multiple variables.
I lean towards nesting routes/actions and each nested action is its
own handler. And if necessary (most of the time it is), your nested
action will used a before filter to load up the parent resource.
For example, lets say your routes was something like:
and you could match it to:
Which in English says, "for Group ID=19, show me the membership for
In the above setup, you would have 2 handlers "groups" and
"group_memberships". Your "group_memberships" has an event called
"show". In this controller it has a before filter that does a DB
lookup on "group_id" and places it in your request context so you have
immediate access to it.
Rails bakes in this approach naturally, but it seems to be a good fit
for CB apps too.
ahh I see... pretty slick!
so do you modify the existing default CB route? Or are you creating
custom routes for each handler, subaction in your web app?
I would create new routes for each of my resources/nested resources
wouldn't your nested actions be optional?
I guess this is the time that I admit... I have never actually built a
CB app. But I have built a ton of Rails apps and thats exactly the
approach that I usually employ. When I do build my first CB app I will
try and employ the same pattern. I didnt know about optional actions /
parameters, so this is good to know...
hah! right on, hey thanks Cody, I'll go ahead and give it a shot...