aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/base.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2004-11-26 02:04:35 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2004-11-26 02:04:35 +0000
commitd0c90331f19004f9f297989785f1516631ea0fc3 (patch)
treeb10ab040e13e1b6dc659364857ae91d8b128dc58 /actionpack/lib/action_controller/base.rb
parentb62937acbd5c14d6499f4e45f4b821043a826044 (diff)
downloadrails-d0c90331f19004f9f297989785f1516631ea0fc3.tar.gz
rails-d0c90331f19004f9f297989785f1516631ea0fc3.tar.bz2
rails-d0c90331f19004f9f297989785f1516631ea0fc3.zip
Added a new container for cookies that makes them more intuative to use. The old methods of cookie and @cookies have been deprecated.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@20 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_controller/base.rb')
-rwxr-xr-xactionpack/lib/action_controller/base.rb32
1 files changed, 5 insertions, 27 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 5c386ac05a..a794272a9a 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -539,33 +539,6 @@ module ActionController #:nodoc:
@performed_redirect = true
end
- # Creates a new cookie that is sent along-side the next render or redirect command. API is the same as for CGI::Cookie.
- # Examples:
- #
- # cookie("name", "value1", "value2", ...)
- # cookie("name" => "name", "value" => "value")
- # cookie('name' => 'name',
- # 'value' => ['value1', 'value2', ...],
- # 'path' => 'path', # optional
- # 'domain' => 'domain', # optional
- # 'expires' => Time.now, # optional
- # 'secure' => true # optional
- # )
- def cookie(*options) #:doc:
- @response.headers["cookie"] << CGI::Cookie.new(*options)
- end
-
- # Alias for cookie "name", "value"
- def cookies[]=(name, value)
- cookie(name, value)
- end
-
- # Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method
- # or cookies[]= (for simple name/value cookies without options).
- def cookies[](name)
- @cookies[name].value if @cookies[name]
- end
-
# Resets the session by clearsing out all the objects stored within and initializing a new session object.
def reset_session #:doc:
@request.reset_session
@@ -573,6 +546,11 @@ module ActionController #:nodoc:
@response.session = @session
end
+ # Deprecated cookie writer method
+ def cookie(*options)
+ @response.headers["cookie"] << CGI::Cookie.new(*options)
+ end
+
private
def initialize_template_class(response)
begin