Rails動作確認
前回のとおりRubyをバージョンアップしてRailsを使おうとしたが,下記のようなエラーで動かず.
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. MissingSourceFile (no such file to load -- mysql): /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' /Library/Ruby/Gems/1.8/gems/activesupport-2.2.2/lib/active_support/dependencies.rb:153:in `require' ...(略)
gemでRuby用のmysqlを入れなければならないみたい.
まずは,portで入れたRubyと,デフォルトで入っているRubyGemsが混在しているのがイヤなので修正.
Railsも入れなおす.
% sudo port install rb-rubygems % sudo gem install rails --include-dependencies % which gem /opt/local/bin/gem % which rails /opt/local/bin/rails
修正してから同じようにアクセスすると,エラーメッセージが短かくなった.
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. 127.0.0.1 - - [31/Dec/2008:12:33:22 JST] "GET /contact/hello/ HTTP/1.1" 500 14203 - -> /contact/hello/
下記のように入れなおすも上手くいかず.
% sudo gem install mysql --include-dependencies ERROR: Error installing mysql: ERROR: Failed to build gem native extension. /opt/local/bin/ruby extconf.rb install mysql --include-dependencies checking for mysql_query() in -lmysqlclient... no checking for main() in -lm... yes ...(略)
色々調べた結果,ここの通りやるとうまくいった.
% sudo gem install mysql -- --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config % gem list .. mysql (2.7) ..