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? Or is it dumb to aspire? The GET would obviously be cluttered with lots of ?, = and &, while a POST is completely silent. -- Florian Ebeling florian.ebeling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
This is directly supported in Rails: http://wiki.rubyonrails.com/rails/show/PrettyURLs On 8/29/05, Florian Ebeling <florian.ebeling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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? Or is it dumb to aspire? > The GET would obviously be cluttered with lots of ?, = and &, > while a POST is completely silent. > > > > -- > Florian Ebeling > florian.ebeling-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >
Hi ! Florian Ebeling said the following on 2005-08-29 15:13:> 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? Or is it dumb to aspire? > The GET would obviously be cluttered with lots of ?, = and &, > while a POST is completely silent.Implement your controller to redirect to the proper URL, and then read all about routes in http://manuals.rubyonrails.com/read/book/9 Bye ! François
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
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? Or is it dumb to aspire? > The GET would obviously be cluttered with lots of ?, = and &, > while a POST is completely silent.Looks like you either want a javascript rewrite on the client side (which I''m not sure could degrade well), or a server-side redirect. The redirect would give you a chance to punt to an error page if you needed, too. I guess the action would look something like this: def user_lookup begin user = User.find_by_name(@params[''name'']) redirect_to :controller=>''messages'', :action=>''user'', :id=>user.name rescue RecordNotFound redirect_to :controller=>''messages'', :action=>''error'' end end Untested, and you''ll probably want to do something with the route, but that looks about right to me. I''m sure someone eminently more qualified will comment shortly... -- Alex
Hi, TinyMce won''t work. The java error consol tells me that baseURL is not set. This must be a configuration problem, but how can I fix it? Thanks! _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
OK, I finally figured out what was wrong, so here we go for posterity: tiny_mce.js should not be declared in the "layout" file, but directly in the page where the textarea is used. Nicolas On 9/1/05, Nicolas Buet <nicolas.buet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi, > > TinyMce won''t work. The java error consol tells me that baseURL is not > set. This must be a configuration problem, but how can I fix it? > Thanks! >_______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails