Hmm... that's a good question.

What would you expect :type to be if you did /search/hello?
type=world ?

As of now, precedence is given to variables in the path (and that
includes optional segments being set to nil), but that could be
reconsidered. My assumption is that if you specify :q in the path and
it is not present there than you would want it to be nil. That
behavior can be opened for discussion.

What do other people think?

-carl

On Oct 21, 11:56 am, tc <[EMAIL PROTECTED]> wrote:
> Hi,
>
> If anyone can answer this question, it would be much appreciated.
> I've been playing around with Merb Router and came across some
> functionality which strikes me as somewhat odd.
>
> If I define a route:
>
> match("/search/:type(:/q)").to(:controller => 'home', :action =>
> 'search')
>
> The "q" parameter is optional.  I can access the action correctly if I
> use the full url (e.g. /search/user/test).  But I also want to have
> the same action accessible by a POST method.  If I have a search form
> send a POST to /search/user with a param "q" in the form, the "q"
> param is wiped out and set to "nil."  It's also wiped out if I call a
> GET with /search/user/?q=test.
>
> If this the functionality that is expected?  Or is this a bug?  Since
> "q" is optional, I would expect to be able to access that action with
> or without the parameter in the url string and not have it set to
> "nil" by the router.
>
> Thanks.
>
> -- tc.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to