Hey there list- I''ve got a routing question I am hoping you folks can help me out with. I''m building a new site for the newspaper I work for and we use a proprietary baseview database for the newsroom and stories. It runs on its own templating/cgi system and I am tying into it by using net/http to send requests for the templates compiled with the data. Now my problem is that the index of a stories page has blurbs about a bunch of stories but the links to the full stories are dynamically generated url''s like this: http://localhost:3000/wrappers/283525245452108.news What I would like to do is be able to have a route rule that would match any request that ended in .news and give me access to the wrappers/283525245452108.news part of the requested url. That way I can route a request for this url through my app and render it correctly. I know that rails looks on the file system for files that have a . in the name. But is there a routing rule that will match anytime the url ends with .news and let me do my processing on it and decide how to render it myself? Thanks in advance for any help with this. It will be a very large cms in the end and I plan to open source any parts of it that would be useful to anyone else. -Ezra Zygmuntowicz Yakima Herald-Republic WebMaster 509-577-7732 ezra-gdxLOakOTQ9oetBuM9ipNAC/G2K4zDHf@public.gmane.org
Ezra Zygmuntowicz said the following on 2005-06-13 13:45:> What I would like to do is be able to have a route rule that would > match any request that ended in .news and give me access to the > wrappers/283525245452108.news part of the requested url. That way I canCan''t you do: map.connect "/wrappers/:news", :requirements => {:news => /(\d+)\.news$/i} I don''t know if you''ll have access to $1 and friends, though. You''ll probably want to read http://manuals.rubyonrails.com/read/chapter/65#page164 See the end of section 2. Bye ! François