Rubyの基礎が多少分かったので、次はRailsの基礎について学んでいきます。
以前書いた通り、既にRailsのインストールは終わっています。
とりあえず、Railsのアプリを動かしてみます。
次のコマンドを実行します。
amebaというアプリケーションを作成
> rails ameba
testというコントローラーを作成
> ruby script\generate controller test
indexというアクションを作成
ameba\apps\controllers\test_controller.rbを開いて
class TestController < ApplicationController
def index
end
end
のように記述
サーバーを起動
> ruby script\server
次のURLにアクセス
http://localhost:3000/test/index
以前書いた通り、既にRailsのインストールは終わっています。
とりあえず、Railsのアプリを動かしてみます。
次のコマンドを実行します。
amebaというアプリケーションを作成
> rails ameba
testというコントローラーを作成
> ruby script\generate controller test
indexというアクションを作成
ameba\apps\controllers\test_controller.rbを開いて
class TestController < ApplicationController
def index
end
end
のように記述
サーバーを起動
> ruby script\server
次のURLにアクセス
http://localhost:3000/test/index