Ideals of generalized matrix rings