LoginSignup

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 5 years have passed since last update.

大学生管理アプリの作成7(Railsで雛形を作っていこう)

Last updated at Posted at 2019-05-21

今までは、MySQLの勉強でしたが、今からはRailsでイチからアプリを作っていきます。

Railsがインストールされていることを確認して下さい。

which rails

表示結果

/usr/local/bin/rails

まだインストールしていない場合は、この記事と動画を見てインストールして下さい。
Ubuntu18.04の中にRails5.2.2をインストール

Railsの雛形を作成

rails new cebu_college -d mysql
cd cebu_college

mini_racerをコメントイン

sed -i -e "s/# gem 'mini_racer', platforms: :ruby/gem 'mini_racer', platforms: :ruby/" Gemfile

mini_racerをインストール

bundle install

RailsとMySQLを繋ぐために設定を変更

vi config/database.yml

passwordは、自分が設定した内容を入れて下さい。

config/database.yml
default: &default
  adapter: mysql2
  encoding: utf8
  pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
  username: root
  password: pass1
  socket: /var/run/mysqld/mysqld.sock

データベースを作成

rails db:create

データベースの存在を確認

mysql -uroot -p -e "show databases" | grep cebu_college

cebu_college_development
cebu_college_test

大学生管理アプリの作成8

0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up