aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/cookies.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-05-22 08:58:43 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-05-22 08:58:43 +0000
commitda0c4c5c9695e2ebe8d98b391d901b598dd293a2 (patch)
tree09894a8d950e73e0a51698e6657c131592ee9ee6 /actionpack/lib/action_controller/cookies.rb
parent0367317dd62ecd177d57d469a4d57974b75e425b (diff)
downloadrails-da0c4c5c9695e2ebe8d98b391d901b598dd293a2.tar.gz
rails-da0c4c5c9695e2ebe8d98b391d901b598dd293a2.tar.bz2
rails-da0c4c5c9695e2ebe8d98b391d901b598dd293a2.zip
Deprecated all render_* methods in favor of consolidating all rendering behavior in Base#render(options). This enables more natural use of combining options, such as layouts
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1350 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/cookies.rb')
-rw-r--r--actionpack/lib/action_controller/cookies.rb22
1 files changed, 14 insertions, 8 deletions
diff --git a/actionpack/lib/action_controller/cookies.rb b/actionpack/lib/action_controller/cookies.rb
index 81f176ad32..ac96ed0e0c 100644
--- a/actionpack/lib/action_controller/cookies.rb
+++ b/actionpack/lib/action_controller/cookies.rb
@@ -3,17 +3,17 @@ module ActionController #:nodoc:
# the cookies being written is what will be sent out will the response. Cookies are read by value (so you won't get the cookie object
# itself back -- just the value it holds). Examples for writing:
#
- # cookies["user_name"] = "david" # => Will set a simple session cookie
- # cookies["login"] = { :value => "XJ-122", :expires => Time.now + 360} # => Will set a cookie that expires in 1 hour
+ # cookies[:user_name] = "david" # => Will set a simple session cookie
+ # cookies[:login] = { :value => "XJ-122", :expires => Time.now + 360} # => Will set a cookie that expires in 1 hour
#
# Examples for reading:
#
- # cookies["user_name"] # => "david"
+ # cookies[:user_name] # => "david"
# cookies.size # => 2
#
# Example for deleting:
#
- # cookies.delete "user_name"
+ # cookies.delete :user_name
#
# All the option symbols for setting cookies are:
#
@@ -24,10 +24,16 @@ module ActionController #:nodoc:
# * <tt>secure</tt> - whether this cookie is a secure cookie or not (default to false).
# Secure cookies are only transmitted to HTTPS servers.
module Cookies
- # Returns the cookie container, which operates as described above.
- def cookies
- CookieJar.new(self)
- end
+ protected
+ # Returns the cookie container, which operates as described above.
+ def cookies
+ CookieJar.new(self)
+ end
+
+ # Deprecated cookie writer method
+ def cookie(*options)
+ @response.headers["cookie"] << CGI::Cookie.new(*options)
+ end
end
class CookieJar < Hash #:nodoc: