Adrien
Adrien

Reputation: 2206

Rails seems unable to find some gems

Yesterday, everything worked fine. You can see my previous Gemfile here.

Then, I added some groups like you can see here.

Since then, I got this message:

Exiting
/Users/adrien/code/adserver/backoffice/config/initializers/airbrake.rb:1:in `<top (required)>': uninitialized constant Airbrake (NameError)

[AirbrakeFullStackTrace]

As I couldn't figure out why I met this behavior and I was stuck, I tried to require airbrake in the corresponding initializer. I relaunched the server and I got the message:

Exiting
/Users/adrien/code/adserver/backoffice/config/initializers/devise.rb:4:in `<top (required)>': uninitialized constant Devise (NameError)

[DeviseFullStackTrace]

Like the error with Airbrake, I required devise in the initializer file and relaunched the server. I got this:

Exiting
/Users/adrien/.rvm/gems/ruby-1.9.3-p194/gems/activerecord-3.2.8/lib/active_record/dynamic_matchers.rb:50:in `method_missing': undefined local variable or method `acts_as_sane_tree' for #<Class:0x007fd3363593f8> (NameError)

[ActsAsSaneTreeFullStackTrace]

I required acs_as_sane_tree in my model file, relaunched the server and now, it works.

Does anybody can tell me what am I doing wrong?

Upvotes: 0

Views: 336

Answers (1)

Adrien
Adrien

Reputation: 2206

Sorry for having bored people. I just got it. For those who play with groups in Gemfile, here is the thing to know and remember.

In config/application.rb, you can find the following instruction:

Bundler.require *Rails.groups(:assets) if defined?(Bundler)

You have to tell Bundler to include any exotic group you added in your Gemfile. So, in my case, that gave us:

Bundler.require *Rails.groups(:assets, :rails, :frontoffice) if defined?(Bundler)

Some help found on the Bundler site, Using Groups.

Upvotes: 1

Related Questions