「Ruby/rails/helloworld」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「==プロジェクト作成== rails new helloworld ===プロジェクト作成(mysqlを使う場合はこちら=== rails new helloworld -d mysql ==コントロー...」) |
(相違点なし)
|
2015年5月20日 (水) 03:11時点における版
プロジェクト作成
rails new helloworld
プロジェクト作成(mysqlを使う場合はこちら
rails new helloworld -d mysql
コントローラー作成
ruby script/rails generate controller test hello
testはコントローラー名、helloはアクション名、ルータが追記(configs/routes.rb)
アクション作成
app/controllers/test_controller.rb
class TestController < ApplicationController def hello end end
ビュー作成
app/view/hello.html.erb
<html><bodyhello</body></html>