Railsのインストール †《関連》 【Railsのインストール】 gem install rails --include-dependencies (補足) Windowsにインストールする場合、以下のエラーが出る事があるので http://www.kaoriya.net/#LIBICONV 等から各dllを取得してruby/bin に設置 SSLEAY32.dllが見つからなかったため、このアプリケーションを開始できませんでした。 zlib.dllが見つからなかったため、このアプリケーションを開始できませんでした。 iconv.dllが見つからなかったため、このアプリケーションを開始できませんでした。 【Mysqlドライバのインストール】 gem install mysql 【railsプロジェクトの作成】 rails -d mysql example ※mySQLを使用する場合 【database.ymlの編集】 development: adapter: mysql database: example_development username: xxxxx password: xxxxx host: localhost encoding: utf8 【rakeコマンドでデータベースを作成】 rake db:create:all 【モデル、コントローラの生成】 ruby script/generate scaffold employee id:integer name:string age:integer 【rakeコマンドでDBをmigrate】 rake db:migrate 【サーバ(WEBrick)の起動】 ruby script/server ※ WEBrickを使わずにApacheでCGIとして動かす場合は dispatch.rb に mod_rewriteする (現在はCGIとしての利用は推奨されていないらしい。Passengerなどを使う。) 【passengerのインストール】 gem install passenger 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 Press ENTER to continue. -------------------------------------------- Suppose you have a Rails application in /somewhere. Add a virtual host to your <VirtualHost *:80> ServerName www.yourhost.com DocumentRoot /somewhere/public # <-- be sure to point to 'public'! <Directory /somewhere/public> AllowOverride all # <-- relax Apache security settings Options -MultiViews # <-- MultiViews must be turned off </Directory> </VirtualHost> And that's it! You may also want to check the Users Guide for security and /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) :-) Phusion Passenger is a trademark of Hongli Lai & Ninh Bui. ※httpd.confを上記で言われた通りに編集する。 |