3
0

More than 1 year has passed since last update.

RubyonRailsチュートリアル:実践メモ【第一章】

Last updated at Posted at 2022-12-15

Ruby on Rails チュートリアル(Webサービス開発が学べる学習サービス)に従って、MVCフレームワークアプリケーションを作成していく。

使用ツール
AWS Cloud9

ルートの設定方法

Railsのルーティングファイルを開き、controller_name(コントローラ名)と、action_name(アクション名)を記載する。
※Railsのルーティングファイル=config/routes.rb

↓↓↓ルーティングの文法形式
root "controller_name#action_name"

実際に当てはめると、
app/controllers/application_controller.rb
なので、controller_name(コントローラ名)はapplication

qiita.rb
class ApplicationController < ActionController::Base

  def hello
    render html: "hello, world!"
  end
end

なので、action_name(アクション名)はhello

root "application#hello"
となる。

参照:RubyonRailsチュートリアル

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