Closed CarBoss1996 closed 1 month ago
実装内容
app/views/posts/index.html.erb app/views/posts/new.html.erb app/views/posts/show.html.erb
- rails g migration CreatePosts class CreatePosts < ActiveRecord::Migration[7.0] def change create_table :posts do |t| t.references :user, foreign_key: true t.text :body t.string :image t.timestamps end end end
・投稿の新規作成、投稿一覧、詳細画面が閲覧できる。 ・バリデーションが発生する場合、投稿が作成できないようにする。 ・投稿が作成できたとき、フラッシュメッセージが出る。
投稿機能の実装
実装内容
作成ページ
app/views/posts/index.html.erb app/views/posts/new.html.erb app/views/posts/show.html.erb
ゴール
・投稿の新規作成、投稿一覧、詳細画面が閲覧できる。 ・バリデーションが発生する場合、投稿が作成できないようにする。 ・投稿が作成できたとき、フラッシュメッセージが出る。