LoginSignup
0
0

More than 5 years have passed since last update.

Ruby on Railsの環境構築とhello worldをデプロイするまで

Last updated at Posted at 2018-08-05

「Ruby on Rails」のチュートリアルは丁寧に説明されてて読みやすくていいですね。
まずは第1章の「ゼロからデプロイまで」をやってみたので備忘録に。。
第1章ゼロからデプロイまで

開発環境構築

下記のサイトを元に構築しました

http://railsgirls.jp/install

初期設定

$ rails new hello_qpp
$ bundle install
$ rails server

デプロイ

herokuを使ってデプロイする

herokuがインストールされてるか確認
$ heroku --version
デプロイ
$ heroku login
$ heroku keys:add
$ heroku create // サブドメインが表示される
$ git push heroku master

ルーティング

ルーティング方法
root 'controller_name#action_name'
application_controller.rb
class ApplicationController < ActionController::Base
  protect_from_forgery with: :exception

  def hello
    render html: "hello, world"
  end
end
routes.rb
Rails.application.routes.draw do
  root 'application#hello'
end

参考サイト

0
0
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
0
0