I''m having a hard time setting up routes. So far what I have is that accessing /photos/view/YYYY-MM-DD correctly accesses the photo stored for that date, but I''d like to be able to access this as simply "/YYYY-MM-DD" My first guess of: map.connect '':year-:month-:day'', :controller => ''photos'', :action => ''view'' Gave me this error: NameError in <controller not set>#<action not set> Which I assume means that rails did not pick up on my route at all. Thanks for any help you can give. -- One Guy With A Camera http://rbpark.ath.cx
Hi! On Sat, 26 Feb 2005, Rob Park wrote the following:> I''m having a hard time setting up routes. > > So far what I have is that accessing /photos/view/YYYY-MM-DD correctly > accesses the photo stored for that date, but I''d like to be able to > access this as simply "/YYYY-MM-DD" >Scott gives some examples here: http://scott.elitists.net/scott/elite-journals-new-routes/view kind regards Wolfgang
On Sat, 26 Feb 2005 17:17:20 +0100, Wolfgang Klinger <wolfgang-qRyVSpHmpvQsV2N9l4h3zg@public.gmane.org> wrote:> Scott gives some examples here: > http://scott.elitists.net/scott/elite-journals-new-routes/viewOk, I''ve been playing with this, and I''ve kinda got it working, but not quite, and I''m not sure why it''s not working. When I do this: map.connect '':created_on'', :controller => ''photos'', :action => ''view'', :requirements => {:created_on => /\d{4}-\d{2}-\d{2}/ } It doesn''t work. I try to access "/2004-09-27" and I get "NameError in <controller not set>#<action not set>", but when I do this: map.connect ''daily/:created_on'', :controller => ''photos'', :action => ''view'', :requirements => {:created_on => /\d{4}-\d{2}-\d{2}/ } it works perfectly when I access "/daily/2004-09-27". How can I make it take out the "daily/" bit and still work? -- One Guy With A Camera http://rbpark.ath.cx