Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Give a more informative error message instead of just raising a load …

…error when mysql gem isn't installed
  • Loading branch information...
commit d20035910c186401c1d957462f4ad7894347c398 1 parent def594b
@jeremy jeremy authored
View
9 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
@@ -58,7 +58,14 @@ def self.mysql_connection(config) # :nodoc:
end
# Require the MySQL driver and define Mysql::Result.all_hashes
- require_library_or_gem('mysql') unless defined? Mysql
+ unless defined? Mysql
+ begin
+ require_library_or_gem('mysql')
+ rescue LoadError
+ $stderr.puts '!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.'
+ raise
+ end
+ end
MysqlCompat.define_all_hashes_method!
mysql = Mysql.init

1 comment on commit d200359

@trevorturk

Just in case this helps anybody else on Mac OS X Leopard, I needed to run the following in order to get the mysql tests running again (although I’m not sure why):

sudo ln -s . /usr/local/mysql/lib/mysql

I got this tip via: http://ruby.macosforge.org/trac/wiki/Troubleshooting

Please sign in to comment.
Something went wrong with that request. Please try again.