** Railsのインストール [#ee8c9371]
#setlinebreak(on);

《関連》
 ・[[Ruby]]
 ・[[Rubyのインストール]]
 ・[[Ruby on Rails]]

【Railsのインストール】
#html(<div style="margin:0px 0px 10px 12px;padding:1px 5px 3px 5px;width:800px;background:#000000;color:#ffffff">)
gem install rails --include-dependencies
※rdocがいらない時は gem install rails --no-rdoc 。(rdocのインストールでエラーになる場合がある時とか)
#html(</div>)


 (補足)
  Windowsにインストールする場合、以下のエラーが出る事があるので
  http://www.kaoriya.net/#LIBICONV 等から各dllを取得してruby/bin に設置
 
  SSLEAY32.dllが見つからなかったため、このアプリケーションを開始できませんでした。
  zlib.dllが見つからなかったため、このアプリケーションを開始できませんでした。
  iconv.dllが見つからなかったため、このアプリケーションを開始できませんでした。

【Mysqlドライバのインストール】
#html(<div style="margin:0px 0px 10px 12px;padding:1px 5px 3px 5px;width:200px;background:#000000;color:#ffffff">)
gem install mysql
#html(</div>)

【railsプロジェクトの作成】
#html(<div style="margin:0px 0px 0px 12px;padding:1px 5px 3px 5px;width:200px;background:#000000;color:#ffffff">)
rails -d mysql example
#html(</div><p style="margin-left:10px;margin-top:0px;padding-top:0px;">※mySQLを使用する場合</p>)


【database.ymlの編集】
 development:
   adapter: mysql
   database: example_development
   username: xxxxx
   password: xxxxx
   host: localhost
   encoding: utf8

【rakeコマンドでデータベースを作成】
#html(<div style="margin:0px 0px 10px 12px;padding:1px 5px 3px 5px;width:200px;background:#000000;color:#ffffff">)
rake db:create:all
#html(</div>)

【モデル、コントローラの生成】
#html(<div style="margin:0px 0px 10px 12px;padding:1px 5px 3px 5px;width:700px;background:#000000;color:#ffffff">)
ruby script/generate scaffold employee id:integer name:string age:integer
#html(</div>)

【rakeコマンドでDBをmigrate】
#html(<div style="margin:0px 0px 10px 12px;padding:1px 5px 3px 5px;width:200px;background:#000000;color:#ffffff">)
rake db:migrate
#html(</div>)

【サーバ(WEBrick)の起動】
#html(<div style="margin:0px 0px 10px 12px;padding:1px 5px 3px 5px;width:200px;background:#000000;color:#ffffff">)
ruby script/server
#html(</div>)
 ※ WEBrickを使わずにApacheでCGIとして動かす場合は dispatch.rb に mod_rewriteする
 (現在はCGIとしての利用は推奨されていないらしい。Passengerなどを使う。)

【passengerのインストール】
#html(<div style="margin:0px 0px 10px 12px;padding:1px 5px 3px 5px;width:800px;background:#000000;color:#ffffff">)
gem install passenger
passenger-install-apache2-module



&nbsp;--------------------------------------------
The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.11/ext/apache2/mod_passenger.so
   PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.11
   PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.


&nbsp;--------------------------------------------
Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   &lt;VirtualHost *:80&gt;
      ServerName www.yourhost.com
      DocumentRoot /somewhere/public    # <-- be sure to point to 'public'!
      &lt;Directory /somewhere/public&gt;
         AllowOverride all              # <-- relax Apache security settings
         Options -MultiViews            # <-- MultiViews must be turned off
      &lt;/Directory&gt;
   &lt;/VirtualHost&gt;

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

&nbsp;&nbsp;/Library/Ruby/Gems/1.8/gems/passenger-2.2.11/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
#html(</div>)
※httpd.confを上記で言われた通りに編集する。


トップ   一覧 単語検索 最終更新   ヘルプ   最終更新のRSS