Rebuilding active record from the ground up in Ruby