Added CookieJar#delete and fixed CookieJar[] to just call first, so you get a string instead of an array back. This limits each cookie to one value, which I consider a mighty fine restriction
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@92 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
cf6282099d
commit
ad354b207a
|
@ -1,5 +1,7 @@
|
||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Fixed to_input_field_tag so it no longer explicitly uses InstanceTag.value if value was specified in the options hash [evl]
|
||||||
|
|
||||||
* Added the possibility of having validate be protected for assert_(in)valid_column #263 [Tobias Luetke]
|
* Added the possibility of having validate be protected for assert_(in)valid_column #263 [Tobias Luetke]
|
||||||
|
|
||||||
* Added that ActiveRecordHelper#form now calls url_for on the :action option.
|
* Added that ActiveRecordHelper#form now calls url_for on the :action option.
|
||||||
|
|
|
@ -36,7 +36,7 @@ module ActionController #:nodoc:
|
||||||
# Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method
|
# 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).
|
# or cookies[]= (for simple name/value cookies without options).
|
||||||
def [](name)
|
def [](name)
|
||||||
@cookies[name.to_s].value if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value)
|
@cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value)
|
||||||
end
|
end
|
||||||
|
|
||||||
def []=(name, options)
|
def []=(name, options)
|
||||||
|
@ -50,6 +50,11 @@ module ActionController #:nodoc:
|
||||||
set_cookie(name, options)
|
set_cookie(name, options)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Removes the cookie on the client machine by setting the value to an empty string.
|
||||||
|
def delete(name)
|
||||||
|
set_cookie(name, "value" => "")
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
def set_cookie(name, options) #:doc:
|
def set_cookie(name, options) #:doc:
|
||||||
cookie = options.is_a?(Array) ? CGI::Cookie.new(*options) : CGI::Cookie.new(options)
|
cookie = options.is_a?(Array) ? CGI::Cookie.new(*options) : CGI::Cookie.new(options)
|
||||||
|
|
Loading…
Reference in New Issue