- ActionController::Routing::Routes.draw do |map|
- map.connect ':controller/service.wsdl', :action => 'wsd'
- map.connect ':controller/:action/:id'
- map.connect ':user', :controller=> 'recipes',
- :action => 'list',
- :filter => 'user'
其实上面的代码是调用map.connect()方法:
- map.connect(String path, Hash options)
再就是Named Routes:
- map.popular 'popular/:tag', :controller => 'recipes',
- :action => 'list',
- :tag => '',
- :filter => 'popular'
这会生成popular_url()和popular_path()方法,前者是绝对路径的链接,后者是相对路径的链接
安徽新华电脑学校专业职业规划师为你提供更多帮助【在线咨询】