Method: Cms::CommonHelper#cookie_jar

Defined in:
app/helpers/cms/common_helper.rb

js cookie accessor



3
4
5
6
7
8
# File 'app/helpers/cms/common_helper.rb', line 3

def cookie_jar(key)
  # if the cookie hasn't been set, need to return '{}' to return a proper hash
  # and if the cookie has been set, but is 'null', we need to then return a ruby hash
  # __CJ_ is the cookiejar js lib postfix value for cookies
  ActiveSupport::JSON.decode(cookies["__CJ_#{key}".to_sym] || '{}') || {}
end