All, I have a route specified as: map.connect '':folder/:filename'', :folder => /htmlfiles/, :controller => "eSimply", :action => "preview_HTML" I expect it to invoke the "preview_HTML" action in the "eSimply" controller. Given an argument of "htmlfiles/xyz.html", it keeps saying that it can''t find an "htmlfiles" action. As you can see, I''m attempting to match the first parameter against "htmlfiles". Any idea why this route won''t match? (I''ve also tried the "requirements form" of the route and can''t get it to work). Thanks, Wes -- Posted via http://www.ruby-forum.com/.
Wes Gamble wrote:> All, > > I have a route specified as: > > map.connect '':folder/:filename'', :folder => /htmlfiles/, :controller => > "eSimply", :action => "preview_HTML" > > I expect it to invoke the "preview_HTML" action in the "eSimply" > controller. > > Given an argument of "htmlfiles/xyz.html", it keeps saying that it can''t > find an "htmlfiles" action. As you can see, I''m attempting to match the > first parameter against "htmlfiles". > > Any idea why this route won''t match?Not sure why that''s not working. But routes will match literals in the main pattern parameter, so you could just do this: map.connect ''htmlfiles/:filename'', :controller => "e_simply", :action => "preview_HTML" Note that I also changed the controller to use the lowercase with underscores form of the name, instead of the camelcase form - that might be causing you problems too. I''m not sure of the details of how :controller must be specified, but I always use the lowercase version and that works for me. --josh Josh Susser http://blog.hasmanythrough.com -- Posted via http://www.ruby-forum.com/.
Am Montag, den 27.03.2006, 23:51 +0200 schrieb Wes Gamble:> All, > > I have a route specified as: > > map.connect '':folder/:filename'', :folder => /htmlfiles/, :controller => > "eSimply", :action => "preview_HTML" > > I expect it to invoke the "preview_HTML" action in the "eSimply" > controller. > > Given an argument of "htmlfiles/xyz.html", it keeps saying that it can''t > find an "htmlfiles" action. As you can see, I''m attempting to match the > first parameter against "htmlfiles". > > Any idea why this route won''t match? > > (I''ve also tried the "requirements form" of the route and can''t get it > to work).Are you sure this route is evaluated? Perhaps a route before it is matching and this is never processed. -- Norman Timmler http://blog.inlet-media.de
It''s being evaluated - what is happening is that the controller is being added to the front of the URL, when actually I don''t want that to happen. I''m requesting the URL via a hard-coded string in Javascript so I didn''t think that the url_for stuff would happen to it, but the request itself must be getting intercepted and modified. In fact, I want to be able to say something like map.connect ''xyz/abc'' :controller => myController, etc. I can''t force it to ignore the controller using :controller => nil, since that will keep it from getting evaluated correctly. But I get the controller in front of my URL which is totally irritating because in order to make it work I probably have to hard code the controller name that I know will be prepended. I think I''d like the URL generation to maybe be less smart. I''m not sure. Wes Norman Timmler wrote:> Am Montag, den 27.03.2006, 23:51 +0200 schrieb Wes Gamble: >> Given an argument of "htmlfiles/xyz.html", it keeps saying that it can''t >> find an "htmlfiles" action. As you can see, I''m attempting to match the >> first parameter against "htmlfiles". >> >> Any idea why this route won''t match? >> >> (I''ve also tried the "requirements form" of the route and can''t get it >> to work). > > Are you sure this route is evaluated? Perhaps a route before it is > matching and this is never processed. > > -- > Norman Timmler > > http://blog.inlet-media.de-- Posted via http://www.ruby-forum.com/.