collectiveidea/awesome_nested_set — pull request #98 by jswanner (2011-10-21 00:22:09+00:00)
Title: Avoid db connection on application boot

awesome_nested_set can prevent `rake assets:precompile` from successfully running. In what seems like a esoteric condition -- a database not existing and a class using awesome_nested_set being loaded on application boot -- is a very real possibility now on heroku combined with Rails 3.1's `rake assets:precompile`, especially if you are using something like Refinery CMS, or a Rails engine that you do not control the code.

## To reproduce:

A model (could be from an engine or something):

```ruby
class Category < ActiveRecord::Base
acts_as_nested_set
end
```

And in config/application.rb:

``` ruby
config.to_prepare do
Category.class_eval do
def to_s
title
end
end
end
```

Then run `RAILS_ENV=env_with_no_db rake assets:precompile` -- or deploy to heroku -- and you will see assets are not being precompiled.