On 2006-01-26, Cees Hek <[EMAIL PROTECTED]> wrote: > Hi All, > > I started playing around with the new CA::Dispatch today for a > project, and I am pretty happy with how it is going so far (thanks > Michael). One of the missing pieces is a simple way of generating > URLs based on the new CA::Dispatch dispatch table that the user sets > up. > > So I tried to tackle that one today, and have some stuff working. > This is really just a notice to the list that I am working on this so > that hopefully there isn't too much duplication of work. It is too > early to publish the results, but if someone is interested in helping > out, or trying it out, I can forward what I have on. > > Effectively all that it will do is add a 'url' method to your base > class. This url method can accept a list of parameters including > 'app' and 'rm' to designate the application and runmode the URL > requires (if the 'app' is omitted, the current application is used). > Then the dispatch table is traversed for an entry that matches up with > the given parameters, and a URI object is created and returned > (complete with path_info and query parameters).
Great Cees. You may be interested in referencing the Rails APIs for this, since they already have methods for this. They are named: url_for link_to (ActionView::Helpers::UrlHelper) link_to_function (ActionView::Helpers::JavaScriptHelper) link_to_if (ActionView::Helpers::UrlHelper) link_to_image (ActionView::Helpers::UrlHelper) link_to_remote (ActionView::Helpers::JavaScriptHelper) link_to_unless (ActionView::Helpers::UrlHelper) link_to_unless_current I haven't read through their docs enough myself to have an opinion yet about how much I like any of them, though. Find the docs here: http://api.rubyonrails.org/ Look in the frame on the lower left hand side for those names, which will link to their documentation. Sometime soon I plan to start using Dispatch on a project as well and will be interested in this when that time comes. Mark -- http://mark.stosberg.com/ --------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[email protected]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
