aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-06-05 13:25:33 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-05 13:25:33 -0700
commite7f1556d0e75c635212273cc5e3cfd113456ff29 (patch)
tree39e81a1fa01bacb18eb2c396d845ebcd815055b9 /actionpack/lib
parent53bcbfbdc1eed45cc6615e59d36baf018ab43d96 (diff)
parentdf8154c845f8fb251c58f1fd882cc221cfdcbbc2 (diff)
downloadrails-e7f1556d0e75c635212273cc5e3cfd113456ff29.tar.gz
rails-e7f1556d0e75c635212273cc5e3cfd113456ff29.tar.bz2
rails-e7f1556d0e75c635212273cc5e3cfd113456ff29.zip
Merge branch 'master' into erbout
Diffstat (limited to 'actionpack/lib')
-rw-r--r--actionpack/lib/action_controller/rack_process.rb42
-rw-r--r--actionpack/lib/action_view/helpers/prototype_helper.rb10
2 files changed, 14 insertions, 38 deletions
diff --git a/actionpack/lib/action_controller/rack_process.rb b/actionpack/lib/action_controller/rack_process.rb
index d5fb78c44d..37b56dabca 100644
--- a/actionpack/lib/action_controller/rack_process.rb
+++ b/actionpack/lib/action_controller/rack_process.rb
@@ -49,21 +49,12 @@ module ActionController #:nodoc:
def cookies
return {} unless @env["HTTP_COOKIE"]
- if @env["rack.request.cookie_string"] == @env["HTTP_COOKIE"]
- @env["rack.request.cookie_hash"]
- else
+ unless @env["rack.request.cookie_string"] == @env["HTTP_COOKIE"]
@env["rack.request.cookie_string"] = @env["HTTP_COOKIE"]
- # According to RFC 2109:
- # If multiple cookies satisfy the criteria above, they are ordered in
- # the Cookie header such that those with more specific Path attributes
- # precede those with less specific. Ordering with respect to other
- # attributes (e.g., Domain) is unspecified.
- @env["rack.request.cookie_hash"] =
- parse_query(@env["rack.request.cookie_string"], ';,').inject({}) { |h, (k,v)|
- h[k] = Array === v ? v.first : v
- h
- }
+ @env["rack.request.cookie_hash"] = CGI::Cookie::parse(@env["rack.request.cookie_string"])
end
+
+ @env["rack.request.cookie_hash"]
end
def host_with_port_without_standard_port_handling
@@ -170,31 +161,6 @@ end_msg
def session_options_with_string_keys
@session_options_with_string_keys ||= DEFAULT_SESSION_OPTIONS.merge(@session_options).stringify_keys
end
-
- # From Rack::Utils
- def parse_query(qs, d = '&;')
- params = {}
- (qs || '').split(/[#{d}] */n).inject(params) { |h,p|
- k, v = unescape(p).split('=',2)
- if cur = params[k]
- if cur.class == Array
- params[k] << v
- else
- params[k] = [cur, v]
- end
- else
- params[k] = v
- end
- }
-
- return params
- end
-
- def unescape(s)
- s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){
- [$1.delete('%')].pack('H*')
- }
- end
end
class RackResponse < AbstractResponse #:nodoc:
diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb
index ed2abba17a..a7c3b9ddc3 100644
--- a/actionpack/lib/action_view/helpers/prototype_helper.rb
+++ b/actionpack/lib/action_view/helpers/prototype_helper.rb
@@ -868,6 +868,16 @@ module ActionView
record "window.location.href = #{url.inspect}"
end
+ # Reloads the browser's current +location+ using JavaScript
+ #
+ # Examples:
+ #
+ # # Generates: window.location.reload();
+ # page.reload
+ def reload
+ record 'window.location.reload()'
+ end
+
# Calls the JavaScript +function+, optionally with the given +arguments+.
#
# If a block is given, the block will be passed to a new JavaScriptGenerator;