Rails2.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"}
route.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
終わり
DBでは、テーブルの名前はtv_showsです。しかし、私のアプリには、ファイルショーが含まれるフォルダーtvがあります。
App = ruby 1.8.6 and Rails 2.3.5
ネストされたルート、名前空間のチュートリアルを教えてください。