public Method

CookieJar.[](name)

Returns the value of the cookie by name — or nil if no such cookie exists. You set new cookies using cookies[]= (for simple name/value cookies without options).

Source Code

# File action_controller/cookies.rb, line 50
def [](name)
  cookie = @cookies[name.to_s]
  if cookie && cookie.respond_to?(:value)
    cookie.size > 1 ? cookie.value : cookie.value[0]
  end
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.