rails g controller Posts #Postテーブルのすべて取得 app/controllers/posts_controller.rb def index @posts = Post.all.order(created_at: "desc") end app/views/posts/index.html.erb <% @posts.each do |post| %> <%= post.title %>:<%= post.body %> <% end %> #投稿フォームのデータを Controller でデータベースに書き込む def article_params params.require(:article).permit(:content, :name, :feeling) end