Why do I need to require my gem in application.rb so that I can use its settings in production?

I’ve released a new Engine yesterday, called oojspec:


It is a testing framework similar to Jasmine.js and Buster.js and it

is integrated to the Rails asset pipeline.

The problem is that I don't understand why I need this line in my

example application hosted on Heroku:


I need `require "oojspec"` just before using the setting declared by

the gem:


And the require is needed only when running under production


This is not a major problem for oojspec itself since it is not meant

to be run under production but by a rake task instead (rake

But I became curious. Why isn't Bundler automatically requiring my

gems before the block in application.rb?

Is there something I could do from the engine gem to expose the

option to application.rb without requiring the gem to be explicitly
loaded before the block?

Thanks in advance,


You’d want to move your gem out of assets if you want it to be available in other environments on heroku.

Allen Madsen

These comments in your gemfile explain why: https://github.com/rosenfeld/oojspec-test/blob/master/Gemfile#L10:L11

Allen Madsen


Thank you, Allen! That makes sense. I’ve already extracted it out of
the assets group.