在 Rails 2.3.5 中。怎么能从
rake routes
(in /home/railsApp)
tv_shows GET /tv_shows(.:format) {:controller=>"tv_shows", :action=>"index"}
POST /tv_shows(.:format) {:controller=>"tv_shows", :action=>"create"}
new_tv_show GET /tv_shows/new(.:format) {:controller=>"tv_shows", :action=>"new"}
edit_tv_show GET /tv_shows/:id/edit(.:format) {:controller=>"tv_shows", :action=>"edit"}
tv_show GET /tv_shows/:id(.:format) {:controller=>"tv_shows", :action=>"show"}
PUT /tv_shows/:id(.:format) {:controller=>"tv_shows", :action=>"update"}
DELETE /tv_shows/:id(.:format) {:controller=>"tv_shows", :action=>"destroy"}
到
rake routes
(in /home/railsApp)
tv_shows GET /tv/shows(.:format) {:controller=>"tv/shows", :action=>"index"}
POST /tv/shows(.:format) {:controller=>"tv/shows", :action=>"create"}
new_tv_show GET /tv/shows/new(.:format) {:controller=>"tv/shows", :action=>"new"}
edit_tv_show GET /tv/shows/:id/edit(.:format) {:controller=>"tv/shows", :action=>"edit"}
tv_show GET /tv/shows/:id(.:format) {:controller=>"tv/shows", :action=>"show"}
PUT /tv/shows/:id(.:format) {:controller=>"tv/shows", :action=>"update"}
DELETE /tv/shows/:id(.:format) {:controller=>"tv/shows", :action=>"destroy"}
路由.rb
map.namespace :tv do |tv|
['shows', 'summaries'].each do |controller|
tv.connect "#{controller}/:action",
:controller => controller,
:conditions => { :method => :get },
:requirements => { :action => /auto_complete_for_\S+/ }
end
tv.resources :summaries
tv.resources :shows
结尾
在数据库中,该表名为 tv_shows。但是在我的应用程序中,我有一个文件夹 tv,其中显示了一个文件。
App = ruby 1.8.6 and Rails 2.3.5
你能给我指出好的嵌套路由,命名空间教程吗?