Home > Enterprise >  Cannot set more than 1 cookie in ruby on rails
Cannot set more than 1 cookie in ruby on rails

Time:06-17

I am making some changes in discourse platform. at a point i want to set 2 cookies namely sso_payload & sso_destination_url

here is what i am doing

cookies[:sso_payload] = payload || request.query_string
cookies[:sso_destination_url] = data[:return_sso_url]

however when i open application tab in google dev tools, only sso_payload cookie is set. I am new to ruby on rails please help

CodePudding user response:

You could store these multiple cookies in an cookie-array, like below:

cookies[:cookies_array] = [payload || request.query_string, data[:return_sso_url]]

The downside is that you need to parse when reading.

  • Related