かんたんRoR 0日目 はじめてのRails
Railsをやろうと思う。あんまりヘビーにやると辛そうなので、概要がサラッと掴める感じの本を選んだ。

かんたんRuby on RailsでWebアプリケーション開発
- 作者: arton
- 出版社/メーカー: 翔泳社
- 発売日: 2006/07/27
- メディア: 大型本
- 購入: 5人 クリック: 211回
- この商品を含むブログ (89件) を見る
タイトルは「かんたん」と書いてあるけど、どうだろうか・・・始めてみる。
Railsの哲学
- DRY「Don't Repeat Yourself」
- 同じ事を繰り返さないこと
- Convention over Configuration
- 設定よりも決まり事を優先すること
超重要。
インストール
Ruby,Railsのインストールは終わっているので、MySQLだけセットアップ。
- MySQL+Apache+PHPをインストールしよう(1/3) − @IT
- Fedora6へのインストールが参考になった。ちなみに起動スクリプトはmysqldだった。
PostgreSQLしか使ったことが無いので、MySQLも覚えようかな。
プロジェクトの作成
helloプロジェクトを作って,
% rails hello
サーバー起動。
% cd hello % ruby script/server => Booting WEBrick... => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options ...(略
Rails application started on http://0.0.0.0:3000と書いてあるので、アクセスしてみる。
おぉぉぉぉぉ。
終了とヘルプの確認。
Ctrl-C to shutdown serverと書いてあるので、Ctrl-Cで終了する。
call with --help for optionsと書いてあるので、serverのヘルプを見てみる。
% ruby script/server --help
=> Booting WEBrick...
Usage: ruby server [options]
-p, --port=port Runs Rails on the specified port.
Default: 3000
-b, --binding=ip Binds Rails to the specified ip.
Default: 0.0.0.0
-e, --environment=name Specifies the environment to run this server under (test/development/production).
Default: development
-m, --mime-types=filename Specifies an Apache style mime.types configuration file to be used for mime types
Default: none
-d, --daemon Make Rails run as a Daemon (only works if fork is available -- meaning on *nix).
-c, --charset=charset Set default charset for output.
Default: UTF-8
-h, --help Show this help message.-dでデーモンになれる。-p, -bあたりも重要。
