Code completion with a gem (mysql2) - how?


I have installed the mysql2 gem, but when I do

require 'mysql2'

I don't get any code completion with it, although the program works. Can you please help with how I can get RubyMine to do inspection/code completion on a gem?


Comment actions Permalink

Hello Murat,

do you have Gemfile in the root of your application? If you create simple Gemfile and add gem 'mysql2' to it, code completion would be available. You can also vote for related issue

Comment actions Permalink

Hi Dennis,

Thanks for your answer. Using gem "mysql2" for require worked.

I have a seemingly related question: When I goto Preferences > Ruby SDK and Gems > install a gem (pick one and install) I get the following error, but then I find the gem in the installed gems window on the same screen.

pg (0.13.1):  Error installing pg:
 ERROR: Failed to build gem native extension.  


mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError) You have to install development tools first.


and a bunch of references to build/compile files in between. Do you know what may be causing it?

thanks again,

Please sign in to leave a comment.