Skip to content

oiax/asagao4

Repository files navigation

『改訂3版 基礎Ruby on Rails』サンプルソース

『改訂3版 基礎Ruby on Rails』(2015年5月、インプレス刊)のサンプルソースです。

書籍情報:http://book.impress.co.jp/books/1114101096
Amazon:http://www.amazon.co.jp/dp/4844338153/

読者サポートページ:http://www.oiax.jp/rails4book

動作確認環境

Ruby 2.2.1または2.2.2、Ruby on Rails 4.2.1
Windowsでは、Ruby 2.1.5または2.1.6をお使いください。

使い方

ダウンロード

次のどちらかでソースコードを入手できます。

  • gitコマンドのgit cloneを使う。
% git clone git@github.com:oiax/asagao4.git
  • 右の「Download ZIP」よりZIPファイルをダウンロードして展開する。

サンプルプログラムの実行

フォルダchapter1chapter3からchapter7section8-1からsection9-5の中にRailsのプログラムがあります。

サンプルを実行したい章、節のフォルダに移動して、bundleコマンドを実行してください。

mac:~ taro% cd asagao4/chapter3
mac:chapter3 taro% bundle install

Chapter 4以降では、Rakeのdb:resetタスクで、データベースの初期化を行ってください。

mac:chapter4 taro% bin/rake db:reset

bin/rails sコマンドでRailsプログラムが起動します。

mac:chapter4 taro% bin/rails s

Windowsの場合

Windowsでは、bundleコマンドを実行する前に、DevKitとSSL証明書の設定を行ってください(本書23-24ページを参照)。

C:¥asagao4¥chapter4> C:¥devkit¥devkitvars
C:¥asagao4¥chapter4> set SSL_CERT_FILE=C:¥Users¥taro¥cacert.pem
C:¥asagao4¥chapter4> bundle install

bin/で始まるコマンドの前にはrubyを付けてください

C:¥asagao4¥chapter4> ruby bin/rake db:reset
C:¥asagao4¥chapter4> ruby bin/rails s

About

改訂3版 基礎Ruby on Rails サンプルソース

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published