Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

root/branches/1-2-stable/actionpack/lib/action_controller/cgi_ext/cgi_ext.rb

Revision 5634, 0.9 kB (checked in by david, 2 years ago)

Fix that redirects should set "Location" header, not "location", and remove dead CGI.redirect

  • Property svn:executable set to *
Line 
1 require 'cgi'
2 require 'cgi/session'
3 require 'cgi/session/pstore'
4 require 'action_controller/cgi_ext/cgi_methods'
5
6 # Wrapper around the CGIMethods that have been secluded to allow testing without
7 # an instantiated CGI object
8 class CGI #:nodoc:
9   class << self
10     alias :escapeHTML_fail_on_nil :escapeHTML
11
12     def escapeHTML(string)
13       escapeHTML_fail_on_nil(string) unless string.nil?
14     end
15   end
16  
17   # Returns a parameter hash including values from both the request (POST/GET)
18   # and the query string with the latter taking precedence.
19   def parameters
20     request_parameters.update(query_parameters)
21   end
22
23   def query_parameters
24     CGIMethods.parse_query_parameters(query_string)
25   end
26
27   def request_parameters
28     CGIMethods.parse_request_parameters(params, env_table)
29   end
30  
31   def session(parameters = nil)
32     parameters = {} if parameters.nil?
33     parameters['database_manager'] = CGI::Session::PStore
34     CGI::Session.new(self, parameters)
35   end
36 end
Note: See TracBrowser for help on using the browser.