開発用&テスト用環境の構築 のバックアップソース(No.1)

更新

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

* 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: 4407 (from 2010/06/03), today: 1, yesterday: 0