Routes Optional Values

I'm trying to my a url that has optional (and not optional values)

for example


A and C are optional
where the following are valid


And the following is invalid


I know the last value can be optional by including ,:c=>nil
But the only way I can think of for middle values to be optional is to
have all permutations written out.

for example
map.connect ':store/:cats/:a/:b/:c, :c=> nil
map.connect ':store/:cats//:b/:c, :a=> nil, :c=> nil

For a couple of variables this is fine, but moving to 3 or more, and it
gets nuts fast.

Is there an easier way to handle this?

Dont' know if it's any easier, but it's a cleaner route...

map.connect ":store/:cats/*args",....

Then in the action that handles the above route, you'll have params[:args] as an array and can do whatever you want with it redirecting to an error (or 404, etc.) page if it isn't what you want.