開発用&テスト用環境の構築 の変更点

更新


SIZE(22){COLOR(RED){このページの内容は非常に古いです(Rails 1.x.x)。最新の Rails では洗練された国際化の機構が標準で入っているため、下記は読むだけ無駄な内容になっています。}}

[[ソフトウェア/rails/言語ネゴシエーション]]


SIZE(22){COLOR(RED){このページの内容は非常に古いです(Rails 1.x.x)。最新の Rails では同様の機能が標準で入っているため、下記は読むだけ無駄な内容になっています。}}

#contents

* negotiation という名前のアプリケーションの作成 [#vb4e8dd6]

テスト用に negotiation という名前のアプリケーションを作成。

 LANG:console
 $ rails negotiation
 $ cd negotiation

* 開発用サーバーの起動と環境の確認 [#s35cbbb4]

 LANG:console
 $ script/server &
 $ wget -qO- http://localhost:3000/ | html2text
  ...
  
  ****** Welcome aboard ******
  ***** You’re riding Ruby on Rails! *****
  **** About_your_application’s_environment ****
  ...
  
 $ $ ls db/*
  ls: cannot access db/*: そのようなファイルやディレクトリはありません
 $ wget -qO- http://localhost:3000/rails/info/properties | html2text
  Ruby version            1.8.7 (i486-linux)
  RubyGems version        1.3.2
  Rails version           2.2.2
  Active Record version   2.2.2
  Action Pack version     2.2.2
  Active Resource version 2.2.2
  Action Mailer version   2.2.2
  Active Support version  2.2.2
  Edge Rails revision     unknown
  Application root        (rails)/negotiation
  Environment             development
  Database adapter        sqlite3
  Database schema version 0
 $ ls db/*
  db/development.sqlite3

このとき自動的に sqlite3 のデータベースが作成される。

* test コントローラとビューの作成 [#k0a5e25a]

 LANG:console
 $ script/generate controller Test
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/test
      exists  test/functional/
      create  app/controllers/test_controller.rb
      create  test/functional/test_controller_test.rb
      create  app/helpers/test_helper.rb
 $ echo "Test" > app/views/test/index.html.erb
 $ (restart script/server)
 $ wget -qO- http://localhost:3000/test
  Test

[[#### 次へ>ソフトウェア/rails/言語ネゴシエーション/多言語化したビューの作成]]~
[[#### 上へ>ソフトウェア/rails/言語ネゴシエーション]]

Counter: 4406 (from 2010/06/03), today: 2, yesterday: 0