0
0

More than 1 year has passed since last update.

Goormで学習をすすめる "Web開発で学ぶプログラミング"

Posted at

こちらの記事を参考に、Goorm にて開発を行いたい初学者の為に、
細かな変更箇所を追記しておきます。
https://zenn.dev/odentravel/books/e69a157daeecb3/viewer/379433

(追記予定)

スクリーンショット 2022-05-24 12.28.58.png
右上にある新しいコンテナをクリックしてください。
コンテナ名 traveler
地域 Seoul (KOR)
公開範囲 Private
テンプレート 基本テンプレート
配備 Not used
ソフトウェアスタック Railsを選択
以上の情報を入力、選択し、コンテナを作成してください。
作成には時間がかかります。

作成されるとロードが入り、このようなページに入ります。
スクリーンショット 2022-05-24 12.41.03.png

右上にある▶Runを押してください。
下部のターミナルがこの様になってたら良いです。

terminal
root@goorm:/workspace/kadai# cd /workspace/kadai && rails s -b 0.0.0.0 -p 3000
=> Booting Puma
=> Rails 6.0.3.2 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 4.3.5 (ruby 2.6.5-p114), codename: Mysterious Traveller
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

Railsアプリケーションページを表示するには、
▶Runの左にあるPreview >
Open Preview in New Tab
を押すと、
新しいタブで下部のようなページが表示されると環境構築は完了です。
スクリーンショット 2022-05-24 12.46.26.png

terminal
root@goorm:/workspace/traveler# rails g controller homes
【↓実行結果例】
Running via Spring preloader in process 2158
      create  app/controllers/homes_controller.rb
      invoke  erb
      create    app/views/homes
      invoke  test_unit
      create    test/controllers/homes_controller_test.rb
      invoke  helper
      create    app/helpers/homes_helper.rb
      invoke    test_unit
      invoke  assets
      invoke    scss
      create      app/assets/stylesheets/homes.scss
app/controllers/homes_controller.rb
class HomesController < ApplicationController
  def top
  end
end
config/routes.rb
Rails.application.routes.draw do
  # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html
  get 'top' => 'homes#top'
end

app/views/homes/top.html.erb
<h1>Topページ</h1>

サーバーの起動は、
右上にある▶Runを押して、▶Runの左にある
Preview > Open Preview in New Tabを押す

terminal
root@goorm:/workspace/traveler# rails g model post
【↓実行結果例】
Running via Spring preloader in process 5959
      invoke  active_record
      create    db/migrate/20220608085956_create_posts.rb
      create    app/models/post.rb
      invoke    test_unit
      create      test/models/post_test.rb
      create      test/fixtures/posts.yml
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