Superconductivity and magnetism in ternary rare-earth compounds