Relative Invariants of Rings: The Commutative Theory