Ruby On Rails

Ruby On Rails

概要

インストール手順

C:\Documents and Settings\UserHome>set http_proxy=http://proxy:8080

C:\Documents and Settings\UserHome>set ftp_proxy=http://proxy:8080

C:\Documents and Settings\UserHome>gem install rails —remote

Bulk updating Gem source index for: http://gems.rubyforge.org
Install required dependency rake? [Yn]  Y
Install required dependency activesupport? [Yn]  Y
Install required dependency activerecord? [Yn]  Y
Install required dependency actionpack? [Yn]  Y
Install required dependency actionmailer? [Yn]  Y
Install required dependency activeresource? [Yn]  Y
Successfully installed rails-2.1.0
Successfully installed rake-0.8.1
Successfully installed activesupport-2.1.0
Successfully installed activerecord-2.1.0
Successfully installed actionpack-2.1.0
Successfully installed actionmailer-2.1.0
Successfully installed activeresource-2.1.0
Installing ri documentation for rake-0.8.1...
Installing ri documentation for activesupport-2.1.0...
Installing ri documentation for activerecord-2.1.0...
Installing ri documentation for actionpack-2.1.0...
Installing ri documentation for actionmailer-2.1.0...
Installing ri documentation for activeresource-2.1.0...
Installing RDoc documentation for rake-0.8.1...
Installing RDoc documentation for activesupport-2.1.0...
Installing RDoc documentation for activerecord-2.1.0...
Installing RDoc documentation for actionpack-2.1.0...
Installing RDoc documentation for actionmailer-2.1.0...
Installing RDoc documentation for activeresource-2.1.0...
 
C:\Documents and Settings\UserHome>env | grep MYSQL
 
C:\Documents and Settings\UserHome>which rails
/cygdrive/c/usr/local/ruby/bin/rails
 
C:\Documents and Settings\UserHome>cd \
 
C:\>cd home
 
C:\home>ls
apadmin         cygwin  eclipse300  fm         idea      osqlfuse.rar  research                    vss                 ?i?d?d?r???\?W1.doc
bkup            dev     eclipse311  fyang      jsc       php           runtime-EclipseApplication  vstudio
crystalspace3d  doc     fin_dept    fyang_org  osqlfuse  plsql         scripte                     ?i?d?d?r???\?W.doc
 
C:\home>mkdir ruby
 
C:\home>cd ruby
 
C:\home\ruby>mkdir hello
 
C:\home\ruby>cd hello
 
C:\home\ruby\hello>rails hello
      create
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  config/initializers
      create  db
      create  doc
      create  lib
      create  lib/tasks
      create  log
      create  public/images
      create  public/javascripts
      create  public/stylesheets
      create  script/performance
      create  script/process
      create  test/fixtures
      create  test/functional
      create  test/integration
      create  test/unit
      create  vendor
      create  vendor/plugins
      create  tmp/sessions
      create  tmp/sockets
      create  tmp/cache
      create  tmp/pids
      create  Rakefile
      create  README
      create  app/controllers/application.rb
      create  app/helpers/application_helper.rb
      create  test/test_helper.rb
      create  config/database.yml
      create  config/routes.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_rails_defaults.rb
      create  config/boot.rb
      create  config/environment.rb
      create  config/environments/production.rb
      create  config/environments/development.rb
      create  config/environments/test.rb
      create  script/about
      create  script/console
      create  script/dbconsole
      create  script/destroy
      create  script/generate
      create  script/performance/benchmarker
      create  script/performance/profiler
      create  script/performance/request
      create  script/process/reaper
      create  script/process/spawner
      create  script/process/inspector
      create  script/runner
      create  script/server
      create  script/plugin
      create  public/dispatch.rb
      create  public/dispatch.cgi
      create  public/dispatch.fcgi
      create  public/404.html
      create  public/422.html
      create  public/500.html
      create  public/index.html
      create  public/favicon.ico
      create  public/robots.txt
      create  public/images/rails.png
      create  public/javascripts/prototype.js
      create  public/javascripts/effects.js
      create  public/javascripts/dragdrop.js
      create  public/javascripts/controls.js
      create  public/javascripts/application.js
      create  doc/README_FOR_APP
      create  log/server.log
      create  log/production.log
      create  log/development.log
      create  log/test.log
 
C:\home\ruby\hello>dir
 ドライブ C のボリューム ラベルがありません。
 ボリューム シリアル番号は 1027-2663 です
 
 C:\home\ruby\hello のディレクトリ
 
2008-06-10  14:01    <DIR>          .
2008-06-10  14:01    <DIR>          ..
2008-06-10  14:01    <DIR>          hello
               0 個のファイル                   0 バイト
               3 個のディレクトリ  51,681,271,808 バイトの空き領域
 
C:\home\ruby\hello>
 
C:\home\ruby\hello\hello>gem install activerecord-oracle-adapter --source http://gems.rubyonrails.org
Need to update 13 gems from http://gems.rubyonrails.org
.............
complete
Successfully installed activerecord-oracle-adapter-1.0.0.9250
 
C:\home\ruby\hello\hello>ruby ruby-oci8-1.0.0-mswin32.rb
ruby: No such file or directory -- ruby-oci8-1.0.0-mswin32.rb (LoadError)
 
C:\home\ruby\hello\hello>ruby \home\ruby\ruby-oci8-1.0.0-mswin32.rb
Copy OCI8.rb to c:/usr/local/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8
Copy oci8.rb to c:/usr/local/ruby/lib/ruby/site_ruby/1.8
Copy oci8lib.so to c:/usr/local/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
OK?
Enter Yes/No: yes
Copying OCI8.rb to c:/usr/local/ruby/lib/ruby/site_ruby/1.8/DBD/OCI8 ... done
Copying oci8.rb to c:/usr/local/ruby/lib/ruby/site_ruby/1.8 ... done
Copying oci8lib.so to c:/usr/local/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt ... done
OK

アプリ開発手順

C:\home\ruby\hello\hello>ruby script/generate scaffold article title:string description:text image_url:string price:decimal publish_date:datetime vender:string category:string
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/articles
      exists  app/views/layouts/
      exists  test/functional/
      exists  test/unit/
      exists  public/stylesheets/
      create  app/views/articles/index.html.erb
      create  app/views/articles/show.html.erb
      create  app/views/articles/new.html.erb
      create  app/views/articles/edit.html.erb
      create  app/views/layouts/articles.html.erb
      create  public/stylesheets/scaffold.css
      create  app/controllers/articles_controller.rb
      create  test/functional/articles_controller_test.rb
      create  app/helpers/articles_helper.rb
       route  map.resources :articles
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/article.rb
      create    test/unit/article_test.rb
      create    test/fixtures/articles.yml
      create    db/migrate
      create    db/migrate/20080610093639_create_articles.rb

Install plugin manually

Download and copy into C:\ruby\lib\ruby\gems\1.8\gems\rails-1.2.3\lib\rails_generator\generators\components
Reference http://d.hatena.ne.jp/pentasa/20070912/1189591260

RoR on Oracle

http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2008/02/mac_de_ruby_on__96e2.html

See Also

http://ruby-oci8.rubyforge.org/ja/
http://www.thinkit.co.jp/cert/article/0605/2/2/3.htm
http://blog.andrewbeacock.com/2007/06/how-to-change-your-rails-database.html
http://wiki.rubyonrails.com/rails/pages/HowtoConnectToOracle
RoRインストール
http://f16.aaa.livedoor.jp/~pseuho/pukiwiki/pukiwiki.php?RoR%A5%A4%A5%F3%A5%B9%A5%C8%A1%BC%A5%EB
Tutorial
Ruby on Rails入門 第1回:Railsが注目されている理由
http://www.thinkit.co.jp/free/article/0605/2/1/

徹底比較!!Ruby on Rails vs Javaフレームワーク第1回:O/Rマッピング
http://www.thinkit.co.jp/free/article/0608/12/1/
DIコンテナとの比較
http://www.thinkit.co.jp/free/article/0608/12/4/

Mac de Ruby on Rails - #7 - Oracleと遊ぶ #6
http://discus-hamburg.cocolog-nifty.com/mac_de_oracle/2008/02/mac_de_ruby_on__96e2.html

Ruby on Rails2.0 チュートリアル 「Webアプリケーション開発方法」
http://www008.upp.so-net.ne.jp/letitbe/rails2/rails002.htm

生産性の高いWeb開発環境 Ruby on Rails
http://itpro.nikkeibp.co.jp/article/COLUMN/20060424/236113/?P=4&ST=lin-server

Use scaffold and paginate on Rails 2.0
http://yoshitan.blog6.fc2.com/blog-entry-194.html

Windows環境での Ruby on Rails (Railsアプリ作成手順)
http://www.syssupo.co.jp/net_hal/ror2.html

RubyOnRails を使ってみる 【第 1 回】
http://jp.rubyist.net/magazine/?0004-RubyOnRails