generate_predictions should now be much faster since there won't be User.count * Track.count calls to Rating.find_or_initialize_by_user_id_and_track_id. Rather, upon creation of a User, Track.count nil ratings will be created, and upon creation of a Track, User.count nil ratings will be created. Thus there is now only a single db query of all ratings upon generate_predictions.