Rails: Get cookie stored in javascript in rails
document.cookie = name + '=' + value + '; path=/'
cookies['foo'] = 'bar'

Reference: