Rails 6.0 でアプリを開発 基本流れ①
rails 6.0は導入し、基本開発部分は同じだと思うので反復するためのメモその1。
1.rails new
2.Gemfile編集
sqliteをtestとdevelopment環境へ変更
pgをproduction環境へ追加
$ bundle install --without production
3.gitに一旦push
$ git init
$ git add -A
$ git commit -m "Initialize repository"
4.リポジトリの作成(bitbucket)
+から作成
5.サーバーのテスト
①application.controller.rbにhelloアクションを作成
②helloアクションをrootに設定
③サーバーの起動
④local:3000でチェック
6.herokuに最初のプッシュ
$ git commit -am "Check server"
$ heroku create
$ git push heroku master
7.bootstrapの導入
①$ yarn add bootstrap jquery popper.js
②config/webpack/environment.jsを編集
③app/javascript/packs/application.jsの編集
④app/javascript/stylesheets/application.scssを作成
bootstrapのインポート
⑤app/views/layouts/application.html.erbの書き換え
8.静的なページを作成
$ rails g controller top_pages home help about contact
9.いったんpush
$ git add -A
$ git commit -m "Add top_pages_controller"
$ git push
$ git push heroku
参照させていただいたサイト
第3章 ほぼ静的なページの作成 - Railsチュートリアル