Rails3.1環境を構築したけどRails2.3系を修正することになった
まずサーバの起動方法が異なるところから躓いた
そして実行してみた
kenmituo@hoge ~/My Documents/Aptana Studio 3 Workspace/2011 $ ruby script/server mongrel c:/Ruby187/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55: unin itialized constant ActiveSupport::Dependencies::Mutex (NameError)
gemのバージョンが新しすぎるから起こる問題らしい。
kenmituo@hoge ~/My Documents/Aptana Studio 3 Workspace/2011 $ gem -v 1.8.24 kenmituo@hoge ~/My Documents/Aptana Studio 3 Workspace/2011 $ gem update --system 1.3.7 Updating rubygems-update Successfully installed rubygems-update-1.3.7 Installing RubyGems 1.3.7 RubyGems 1.3.7 installed (だらだら続く)
実行してみる
kenmituo@hoge ~/My Documents/Aptana Studio 3 Workspace/2011 $ ruby script/server mongrel => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 c:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Depen dency#version_requirements is deprecated and will be removed on or after August 2010. Use #requi rement
なんか変なので再確認
$ gem -v 1.3.7 $ rails -v Rails 3.2.9 $ gem list rails -l *** LOCAL GEMS *** rails (3.2.9, 2.3.5)
ん・・・
config/environment.rb
# Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
指定しているから大丈夫なはず。
一つ目の問題:競合
結果はconfig/initializers/hoge_init.rbが競合していた。
2つ目の問題:MySQLのバージョン
$ ruby script/server mongrel => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 c:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement c:/Ruby187/lib/ruby/gems/1.8/gems/mysql-2.9.0-x86-mingw32/lib/mysql/1.8/mysql_api.so: Incorrect MySQL client library version! This gem was compiled for 6.0.0 but the client library is 4.1.22. (RuntimeError)
4.1.22ではダメです!6.0.0だ!
http://www-jp.mysql.com/downloads/connector/c/からzipをダウンロード、「\mysql-connector-c-noinstall-6.0.2-win32\lib\libmysql.dll」を「\ruby187\bin\libmysql.dll」にコピー
次のエラーになる
$ ruby script/server mongrel => Booting Mongrel => Rails 2.3.5 application starting on http://0.0.0.0:3000 c:/Ruby187/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is deprecated and will be removed on or after August 2010. Use #requirement c:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:589:in `real_connect': Can't connect to MySQL server on 'localhost' (10061) (Mysql::Error)
なやんだ結果
config/database.yml
エラーは収まってくれた。