pcasa
pcasa

Reputation: 3730

Store cookie from HTTP header

How do you store a cookie with basic info.

i.e. link is http://www.domain.com/index.html?ref=123

How would I store a cookie with name of "ref" and the value of "123"?

Upvotes: 0

Views: 179

Answers (1)

zed_0xff
zed_0xff

Reputation: 33257

see http://api.rubyonrails.org/classes/ActionController/Cookies.html

use following code in your controller:

cookies[:ref] = 123

or

cookies[:ref] = params[:ref]

Upvotes: 1

Related Questions