Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't set callbacks in test environment
- Loading branch information
Fernando Blat Peris
committed
Aug 16, 2009
1 parent
6006b97
commit 6895258
Showing
1 changed file
with
5 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
Dir.glob(RAILS_ROOT + '/lib/collections/*.rb').each do |collection| | ||
require collection | ||
# Sets callbacks in models | ||
collection_class = collection.split('/').last.split('.').first.camelize.constantize | ||
collection_class.send(:set_callbacks) | ||
# Sets callbacks in models except if test environment (not so elegant) | ||
unless Rails.env.test? | ||
collection_class = collection.split('/').last.split('.').first.camelize.constantize | ||
collection_class.send(:set_callbacks) | ||
end | ||
end |