'

Railscasts - Named Routes
Railscasts - Custom REST Actions
より


なんとなくrails使ってると(scaffoldすると自動でmap.resourcesされるから)〜path/〜urlって時々出てくるけど
そこらへんは、routes.rbで設定してたと。

メモ

map.home "", :controller => 'hoge', :action => 'index'
→home_url  #/
  home_path #http://localhost:3000
map.fuga_archive 'tasks/:year/:month', :controller => 'fuga', :action => 'archive'
→fuga_archive_path
  fuga_archive_url
map.resources :projects
→project_path(project)
  edit_project_path(project)
  project_path(project), :method => :delete  
  new_project_path


map.resourcesの書き方。collection/memberを指定。

map.resources :tasks, :collection => { :completed => :get }, :member => { :complete => :put }
→complete_task_path(task)
  completed_tasks_path
広告を非表示にする