method
build_cookie
rails latest stable - Class:
ActionController::Session::CookieStore
Method deprecated or moved
This method is deprecated or moved on the latest stable version. The last existing version (v2.3.8) is shown here.
build_cookie(key, value)private
Should be in Rack::Utils soon
# File actionpack/lib/action_controller/session/cookie_store.rb, line 129
def build_cookie(key, value)
case value
when Hash
domain = "; domain=" + value[:domain] if value[:domain]
path = "; path=" + value[:path] if value[:path]
# According to RFC 2109, we need dashes here.
# N.B.: cgi.rb uses spaces...
expires = "; expires=" + value[:expires].clone.gmtime.
strftime("%a, %d-%b-%Y %H:%M:%S GMT") if value[:expires]
secure = "; secure" if value[:secure]
httponly = "; HttpOnly" if value[:httponly]
value = value[:value]
end
value = [value] unless Array === value
cookie = Rack::Utils.escape(key) + "=" +
value.map { |v| Rack::Utils.escape(v) }.join("&") +
"#{domain}#{path}#{expires}#{secure}#{httponly}"
end Related methods
- Instance methods
- call
- Class methods
- new
- Private methods
-
build_cookie -
ensure_secret_secure -
ensure_session_key -
generate_sid -
inject_persistent_session_id -
load_session -
marshal -
persistent_session_id! -
requires_session_id? -
unmarshal -
verifier_for