Fix for ActiveRecord 3