==============================
コマンドライン
==============================
– プロジェクト作成
rails new project_name
– サーバ立ち上げ
rails server
– 新規ページ作成
rails generate controller コントローラ名 アクション名
– Migrateion File作成
rails g model テーブル名(単数形) カラム名:データ型
– Migration実行
rails db:migrate
– rails console立ち上げ
rails console
==============================
データベース操作
==============================
– 取得
@posts = Post.all
– 書き込み
post = Post.new(content: データ)
post.save
==============================
文法
==============================
– foreach
<% @posts.each do |post| %>
処理
<% end %>
– link
<%= link_to(post.content, "/posts/#{post.id}") %>
第一引数は表記、第二引数はリンク先
– 並び替え
@posts = Post.all.order(created_at: :desc)

