My rails server runs on localhost. I want to set a cookie for the
domain ".myapp.com". How do I do this?
You can only set the domain to a parent of the website serving the
request (so if the browser accesses the website as foo.bar.com then
you can set a cookie for foo.bar.com or bar.com). Apart from that I've
set cookies in exactly the way you show.