This Question is Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
2 Replies Last post: May 29, 2011 1:01 AM by Sharad Jain  
John Wang Newbie 2 posts since
Mar 23, 2011
Currently Being Moderated

Mar 23, 2011 12:24 AM

uninitialized constant MysqlCompat::MysqlRes with RubyMine 3.1

I'm getting this error when running the development environment through RubyMine 3.1. The mysql gem is attached, it's running off of Bundler.

Gemfile

gem "mysql",         "2.8.1"

 

Gem was installed using:

gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

via Bundler config.

=> Booting WEBrick
=> Rails 2.3.10 application starting on http://0.0.0.0:3000 [2011-03-21
13:36:43] INFO WEBrick 1.3.1
[2011-03-21 13:36:43] INFO ruby 1.8.7
(2011-02-18) [i686-darwin10.7.1]
[2011-03-21 13:36:43] INFO
WEBrick::HTTPServer#start: pid=625
port=3000
=> Call with -d to detach
=> Ctrl-C to shutdown server /!\ FAILSAFE /!\ Mon Mar 21 13:36:46
-1000 2011 Status: 500 Internal Server Error uninitialized constant
MysqlCompat::MysqlRes

System is using RVM, gemset and ruby 1.8.7, rails 2.3.10, and mysql 5.5.10

 

I can run the Rails console and server fine through Terminal via

ruby script/server
ruby script
/console

 

Problem seems to be isolated to just trying to run the Rails console and server through RubyMine. There's likely some small configuration setting that I'm missing and haven't seen.

RubyMine is configured to use the ruby and gemset from RVM and it's set to ignore the global gemset as well.

 

Most solutions I've seen state to downgrade to mysql 5.1, but that doesn't seem to be the real solution as I can run the Rails console and server perfectly fine from the Terminal.

 

I've also gone ahead and tried setting up the PATH to see if that's what's causing the problem via: http://devnet.jetbrains.net/docs/DOC-1160

 

From RubyMine

puts ENV['PATH']

/Users/john/.rvm/gems/ruby-1.8.7-p334/bin:/Users/john/.rvm/gems/ruby-1.8.7-p334@global/bin:/Users/john/.rvm/rubies/ruby-1.8.7-p334/bin:/Users/john/.rvm/gems/ruby-1.8.7-p334@imiloa/bin:/Users/john/.rvm/rubies/ruby-1.8.7-p334/bin:/Users/john/.rvm/gems/ruby-1.8.7-p334@global/bin:/Users/john/.rvm/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin

 

From Terminal:

/Users/john/.rvm/gems/ruby-1.8.7-p334/bin:/Users/john/.rvm/gems/ruby-1.8.7-p334@global/bin:/Users/john/.rvm/rubies/ruby-1.8.7-p334/bin:/Users/john/.rvm/gems/ruby-1.8.7-p334@imiloa/bin:/Users/john/.rvm/gems/ruby-1.8.7-p334@global/bin:/Users/john/.rvm/rubies/ruby-1.8.7-p334/bin:/Users/john/.rvm/bin:/usr/local/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/X11/bin:/usr/local/mysql/bin:/Developer/android-sk-mac/tools:/Users/john/Library/SDKs/gsutil:/usr/local/jruby/bin:/Users/john/opt/mirah/bin:/usr/local/appengine-java-sdk/bin:/Users/john/go/bin:/Users/john/.ec2/bin

 

I have some extra items inside of the Terminal path, but that shouldn't be of any trouble for RubyMine.

Sharad Jain Newbie 1 posts since
May 29, 2011
Currently Being Moderated
May 29, 2011 1:01 AM in response to: John Wang
Re: uninitialized constant MysqlCompat::MysqlRes with RubyMine 3.1

This is an issue for me too.

 

I am using ruby 1.8.7, Rails 2.3.11 and bundler and RubyMine 3.1.

 

I installed mysql 5.5 and mysql 2.8.1 gem according to instructions here:

 

1) http://www.tatvartha.com/2010/10/installing-mysql-gem-with-bundler-on-snow-leopard/

and

2) http://weblog.rubyonrails.org/2009/8/30/upgrading-to-snow-leopard

 

The setup works fine with mysql from command line.

 

Inside RubyMine, I get:

 

===========

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) -Itest /Users/sjain/projects/morex/mx/test/unit/rate_test.rb

Testing started at 3:49 PM ...

** Erubis 2.6.6

/Users/sjain/projects/morex/mx/vendor/bundle/ruby/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:466:in `load_missing_constant': uninitialized constant MysqlCompat::MysqlRes (NameError)

from /Users/sjain/projects/morex/mx/vendor/bundle/ruby/1.8/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:106:in `rake_original_const_missing'

from /Users/sjain/projects/morex/mx/vendor/bundle/ruby/1.8/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'

from /Users/sjain/projects/morex/mx/vendor/bundle/ruby/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/mysql_adapter.rb:9:in `define_all_hashes_method!'

from /Users/sjain/projects/morex/mx/vendor/bundle/ruby/1.8/gems/activerecord-2.3.11/lib/active_record/connection_adapters/mysql_adapter.rb:68:in `mysql_connection'

...

...

Empty test suite.

 

Process finished with exit code 1

===========

This has been a blocker for me to switch from Netbeans to RubyMine.

 

More Like This

  • Retrieving data ...