Ruby on Rails道場 part1
————————————————————————————————
▼ 開発環境の生成とTOP作成
————————————————————————————————
> rails new appName
→雛形ファイル作成
>rails server
→ローカルサーバー起動
> rails generate controller home top
・controller
・view
・css
> get "/" => "home#top”
→ルーティングの設定
————————————————————————————————
▼ ABOUTページ
————————————————————————————————
> get “about/" => “home#about”
→ルーティングの設定
> def about
> end
→コントローラーの作成
> /view/home/file about.html
→Viewの作成
————————————————————————————————
▼ テーブルの作成 + INSERTクエリ
————————————————————————————————
> rails g model Post Content:text
→migrationFile作成(=クラス作成)
> rails db:migrate
→テーブル作成(=インスタンス作成)
> rails console
→コンソール起動
> post1 = Post.new(content: “post1”)
→インスタンス作成+クエリ作成
>post1.save
→トランザクション + クエリ実行