Fixing multiple story repeat by adding set operation in rails