dimanche 15 novembre 2015

How to store more than one values, in same cookie - Rails

So i want to store a comment_id:value pair and a comment_user:value pair

So far i do this

cookies.signed[:comment_author] = { value: @comment.id, expires: 2.hour.from_now }

Basically i am trying to figure out how to store more than one value to same cookie so to avoid creating multiple cookies for same user. Is that possible?

Question 2: how can i dynamically append to that cookie if any values exist?

Aucun commentaire:

Enregistrer un commentaire