2021-05-01から1日間の記事一覧
♡config/routes.rbへの追記 ♡app/boards.controller.rbへの追記(詳細画面の追加) ♡app/comments.controller.rbの設定 ①config/routes.rbへの追記(ネストする) resources :boards, only: %i[index new create show] do resources :comments, only: %i[create]…
<手順> ♡コメントのデータベースの作成し、DB側に制約をかける ♡userとboardモデルに紐付けをする ♡コメントモデルに制約を追加する ①コメントのデータベースを作成 rails g model Comment body:text user:references board:references 外部キー制約をする際…