Permalink
Browse files

Deprecation: @request will be removed after 1.2. Use the request meth…

…od instead.

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5201 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
jeremy committed Sep 29, 2006
1 parent c0eccc9 commit d7674637f9ac7c9764a4fe09dbc15ee239ce5a77
View
@@ -1,5 +1,7 @@
*SVN*
+* Deprecation: @request will be removed after 1.2. Use the request method instead. [Jeremy Kemper]
+
* Make the :status parameter expand to the default message for that status code if it is an integer. Also support symbol statuses. [Jamis Buck]. Examples:
head :status => 404 # expands to "404 Not Found"
@@ -294,7 +294,7 @@ class Base
# Holds the request object that's primarily used to get environment variables through access like
# <tt>request.env["REQUEST_URI"]</tt>.
- attr_accessor :request
+ attr_internal :request
# Holds a hash of all the GET, POST, and Url parameters passed to the action. Accessed like <tt>params["post_id"]</tt>
# to get the post_id. No type casts are made, so all values are returned as strings.
@@ -1014,7 +1014,7 @@ def initialize_template_class(response)
end
def assign_shortcuts(request, response)
- @request, @_params, @cookies = request, request.parameters, request.cookies
+ @_request, @_params, @cookies = request, request.parameters, request.cookies
@response = response
@response.session = request.session
@@ -1030,7 +1030,7 @@ def assign_shortcuts(request, response)
# TODO: assigns cookies headers params request response template
- DEPRECATED_INSTANCE_VARIABLES = %w(flash params session)
+ DEPRECATED_INSTANCE_VARIABLES = %w(flash params request session)
# Gone after 1.2.
def assign_deprecated_shortcuts(request, response)
@@ -1128,7 +1128,7 @@ def protected_instance_variables
%w(@assigns @performed_redirect @performed_render)
else
%w(@assigns @performed_redirect @performed_render
- @request @response @_params @_session @session
+ @_request @request @response @_params @params @_session @session
@cookies @template @request_origin @parent_controller)
end
end
@@ -139,22 +139,22 @@ def component_class(options)
self.class
end
end
-
+
# Create a new request object based on the current request.
# The new request inherits the session from the current request,
# bypassing any session options set for the component controller's class
def request_for_component(controller_name, options)
- request = @request.dup
- request.session = @request.session
-
- request.instance_variable_set(
+ new_request = request.dup
+ new_request.session = request.session
+
+ new_request.instance_variable_set(
:@parameters,
(options[:params] || {}).with_indifferent_access.update(
"controller" => controller_name, "action" => options[:action], "id" => options[:id]
)
)
-
- request
+
+ new_request
end
def component_logging(options)
@@ -1,7 +1,7 @@
<h1>
<%=h @exception.class.to_s %>
- <% if @request.parameters['controller'] %>
- in <%=h @request.parameters['controller'].humanize %>Controller<% if @request.parameters['action'] %>#<%=h @request.parameters['action'] %><% end %>
+ <% if request.parameters['controller'] %>
+ in <%=h request.parameters['controller'].humanize %>Controller<% if request.parameters['action'] %>#<%=h request.parameters['action'] %><% end %>
<% end %>
</h1>
<pre><%=h @exception.clean_message %></pre>
@@ -85,7 +85,7 @@ def verify_action(options) #:nodoc:
if !prereqs_invalid && options[:method]
prereqs_invalid ||=
- [*options[:method]].all? { |v| @request.method != v.to_sym }
+ [*options[:method]].all? { |v| request.method != v.to_sym }
end
prereqs_invalid ||= (request.xhr? != options[:xhr]) unless options[:xhr].nil?
@@ -147,8 +147,8 @@ class Base
attr_accessor :base_path, :assigns, :template_extension
attr_accessor :controller
- attr_reader :logger, :request, :response, :headers
- attr_internal :flash, :params, :session
+ attr_reader :logger, :response, :headers
+ attr_internal *ActionController::Base::DEPRECATED_INSTANCE_VARIABLES
# Specify trim mode for the ERB compiler. Defaults to '-'.
# See ERB documentation for suitable values.
@@ -440,11 +440,11 @@ def create_template_source(extension, template, render_symbol, locals)
if template_requires_setup?(extension)
body = case extension.to_sym
when :rxml
- "@controller.response.content_type ||= 'application/xml'\n" +
+ "controller.response.content_type ||= 'application/xml'\n" +
"xml = Builder::XmlMarkup.new(:indent => 2)\n" +
template
when :rjs
- "@controller.response.content_type ||= 'text/javascript'\n" +
+ "controller.response.content_type ||= 'text/javascript'\n" +
"update_page do |page|\n#{template}\nend"
end
else
@@ -525,4 +525,4 @@ def compile_template(extension, template, file_name, local_assigns)
end
end
-require 'action_view/template_error'
+require 'action_view/template_error'
Oops, something went wrong.

0 comments on commit d767463

Please sign in to comment.