Cyclic codes as submodules of rings and direct product of rings