In Ruby on Rails, how can I do the equivalent of this in a more elegant routes line? I may have to add many of these…
map.connect '/about', :controller => "site", :action => "about"
map.connect '/contact', :controller => "site", :action => "contact"
map.connect '/preview', :controller => "site", :action => "preview"
Thanks!
You can do this:
The part
:action => /about|contact|preview/makes sure that only the listed words can be used asactionin this route,.