Re: Query sensible URL from form

Jakob L. Skjerning
Wed, 31 Aug 2005 07:52:41 -0000

Florian Ebeling wrote:
> Consider a small form:
>
> User: [________]  [Submit]
>
> Then you want to go to a sensible ("pretty") URL like
>
> /messages/user/febeling
>
> Is there a rails approach to this?

I suppose you could have an action that recieves the data from the form
and redirect_to "/messages/user/#{params[:query]}" or some such.

I do wonder, though, if it is possible to make Rails routes do that bit
of rewriting. Probably not, since Routes doesn''t actually change the
displayed URL.

On the flipside, is the difference from /messages/user/febeling to
/messages?user=febeling that important?


--
Jakob L. Skjerning - http://mentalized.net