# Rails 3: Can Bundle.require be called after Application class is defined?

**URL:** <https://www.ruby-forum.com/t/rails-3-can-bundle-require-be-called-after-application-class-is-defined/183505>\
**Category:** Rails\
**Created:** [February 15, 2010, 7:52pm UTC](https://www.ruby-forum.com/t/rails-3-can-bundle-require-be-called-after-application-class-is-defined/183505 "2010-02-15T19:52:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![g0nzo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/3bc359/32.png) [@g0nzo](https://www.ruby-forum.com/u/g0nzo)\
**Post date:** [February 15, 2010, 7:52pm UTC](https://www.ruby-forum.com/t/rails-3-can-bundle-require-be-called-after-application-class-is-defined/183505/1 "2010-02-15T19:52:28Z")

</div>

Hi,

I’m trying to use shoulda in Rails 3 and there’s a small problem. I’m  
using branch “rails3” from shoulda repository -  
[http://github.com/thoughtbot/shoulda/tree/rails3](http://github.com/thoughtbot/shoulda/tree/rails3).

The problem is that shoulda tries to auto load some files from  
predefined paths and uses Rails.root to build these paths, however, at  
the moment that shoulda is required Rails.root is nil.

In generated application.rb “Bundle.require” is called first and then  
Application class is defined, which in turn initializes some stuff  
like i.e. Rails.root. Is there any reason why “Bundle.require” can’t  
be called after defining Application class? It solves my problem with  
shoulda.

Cheers,  
Szymek
