Simplified the set_cookie method and made it indifferent to symbol or string as name

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@343 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 70039d1e
...@@ -51,16 +51,16 @@ def []=(name, options) ...@@ -51,16 +51,16 @@ def []=(name, options)
options = { "name" => name, "value" => options } options = { "name" => name, "value" => options }
end end
set_cookie(name, options) set_cookie(options)
end end
# Removes the cookie on the client machine by setting the value to an empty string. # Removes the cookie on the client machine by setting the value to an empty string.
def delete(name) def delete(name)
set_cookie(name, "name" => name, "value" => "") set_cookie("name" => name.to_s, "value" => "")
end end
private private
def set_cookie(name, options) #:doc: def set_cookie(options) #:doc:
options["path"] = "/" unless options["path"] options["path"] = "/" unless options["path"]
cookie = CGI::Cookie.new(options) cookie = CGI::Cookie.new(options)
@controller.logger.info "Cookie set: #{cookie}" unless @controller.logger.nil? @controller.logger.info "Cookie set: #{cookie}" unless @controller.logger.nil?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册