最終更新:2019-06-10 (月) 04:06:15 (1774d)
Rails/config/routes.rb
確認
Rails/ルーティング
Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html end
メモ
- 外部からのリクエストをコントローラとアクションに振り分ける方法を、DSL (ドメイン特化言語: domain-specific language)という特殊な言語でこのファイル内に記述します
DSL
Rails/get
get 'uri/pattern' to: 'コントローラー#アクション' get '/patients/:id', to: 'patients#show', as: 'patient'
Rails/root?
root コントローラー#アクション
Rails/resources
- index、show、new、edit、create、update、destroyアクションを個別に宣言しなくても1行で宣言が完了します。
resources :photos
メモ
resources :photos, :books, :videos
- 上の記法は以下と完全に同一です。
resources :photos resources :books resources :videos