Counter for any ActiveRecord model for specified time periods