Error: Rails gem is not activated for module.


I'm seeing a strange problem where I have a JRuby on Rails module that I cannot run using a Rails Run Configuration because it tells me that my Rails gem is not activated.  I'm not really sure what this means because all indications are that the Rails gem is correctly installed and working fine.  If I navigate in my Rails app down to script/server and launch that script as a Ruby Run Configuration it works just fine.  So obviously the Rails gem is present.

Here are some screen shots showing the issue.  First, the Rails Run Configuration showing an error:


Then this is the error that pops up when I try to actually launch this Rails Run Configuration:


This shot shows my Module Settings listing the installed gems:


And then also a few of the gems in the Platform Setting's Global Libraries:


The strange thing is that I actually had it working at one point, but only for one run.  After that one successful run I started getting this error and I can't make it go away, even after dropping the Module and recreating it again.

I'm using IntelliJ 10.5 with Ruby Plugin 3.1 and JRuby 1.5.1.

Any ideas what might be causing this?

Thanks in advance,

Comment actions Permalink

I had same problem,
adding to Gemfile

gem 'rake', '0.8.7'
fixed issue

Comment actions Permalink

I ran into the exact same issue as Scott with the same version of your IDE and the same version of Ruby/Rails. Now I realize that the problem is that IDEA did not detect gem dependencies properly when I initially tried to create the JRubyRails module from scratch against the existing Rails app source.

By accident, I happened to modify the associating IML file for this module. When I returned to the IDEA project, I was presented with a dialog stating that the project file for the associating module was modified externally; would I like to reload the project. I selected 'yes'. Once restarted, IDEA began to detect gem dependencies for all Ruby modules in my project.

As you can see from the Dependencies tab for the Ruby module, it was able to autodetect those gems after reloading.


I understand that an alternate solution would have been to explicitly add the gem dependencies to the module. Of course, it’s still likely easier to force IDEA to rescan dependencies automatically if it failed to do so the first time. Is this possible to do within the IDE as opposed to the hack I described above?

It seems like a bug that IDEA doesn't detect gem dependencies properly the first time the module is created/imported.

Comment actions Permalink

Hi guys,

Thank you for a feedback, I filed an issue: RUBY-9143 Ruby plugin doesn't attach gems while creating project from existing sources


Please sign in to leave a comment.