Wednesday, September 15, 2010

Beware ActiveSupports Default Autoload Mechanism

By default active_support sets its dependency loading mechanism to load rather than require. We're working on a non rails app with datamapper and some models add before :create hooks. If you dont take care, these models are loaded twice and the hooks are added twice which can result in strange behaviour.

So remember to do this ActiveSupport::Dependencies.mechanism = :require

No comments:

Post a Comment