aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-08-07 12:40:14 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-08-07 12:40:14 +0000
commitc40b1a4a67ccaa3be31edb13399d93da0c628567 (patch)
tree2c943fc5485bb29617911afd8da56bd269103bee /actionpack/lib
parenta3b045a73e729e44719713084462825ef98f8bc0 (diff)
downloadrails-c40b1a4a67ccaa3be31edb13399d93da0c628567.tar.gz
rails-c40b1a4a67ccaa3be31edb13399d93da0c628567.tar.bz2
rails-c40b1a4a67ccaa3be31edb13399d93da0c628567.zip
Deprecate direct usage of @params. Update ActionView::Base for instance var deprecation.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4715 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rwxr-xr-xactionpack/lib/action_controller/base.rb20
-rw-r--r--actionpack/lib/action_controller/pagination.rb2
-rw-r--r--actionpack/lib/action_controller/rescue.rb4
-rw-r--r--actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml2
-rw-r--r--actionpack/lib/action_controller/verification.rb4
-rw-r--r--actionpack/lib/action_view/base.rb3
6 files changed, 19 insertions, 16 deletions
diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb
index 03b89826ce..8823076fcc 100755
--- a/actionpack/lib/action_controller/base.rb
+++ b/actionpack/lib/action_controller/base.rb
@@ -287,17 +287,17 @@ module ActionController #:nodoc:
# Holds the request object that's primarily used to get environment variables through access like
# <tt>request.env["REQUEST_URI"]</tt>.
attr_accessor :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.
- attr_accessor :params
-
+ attr_internal :params
+
# Holds the response object that's primarily used to set additional HTTP headers through access like
# <tt>response.headers["Cache-Control"] = "no-cache"</tt>. Can also be used to access the final body HTML after a template
# has been rendered through response.body -- useful for <tt>after_filter</tt>s that wants to manipulate the output,
# such as a OutputCompressionFilter.
attr_accessor :response
-
+
# Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person"
# key. The session will hold any type of object as values, but the key should be a string or symbol.
attr_internal :session
@@ -932,7 +932,7 @@ module ActionController #:nodoc:
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
@@ -946,7 +946,7 @@ module ActionController #:nodoc:
# TODO: assigns cookies headers params request response template
- DEPRECATED_INSTANCE_VARIABLES = %w(flash session)
+ DEPRECATED_INSTANCE_VARIABLES = %w(flash params session)
# Gone after 1.2.
def assign_deprecated_shortcuts(request, response)
@@ -1019,16 +1019,18 @@ module ActionController #:nodoc:
end
def add_class_variables_to_assigns
- %w( template_root logger template_class ignore_missing_templates ).each do |cvar|
+ %w(template_root logger template_class ignore_missing_templates).each do |cvar|
@assigns[cvar] = self.send(cvar)
end
end
def protected_instance_variables
if view_controller_internals
- [ "@assigns", "@performed_redirect", "@performed_render" ]
+ %w(@assigns @performed_redirect @performed_render)
else
- [ "@assigns", "@performed_redirect", "@performed_render", "@request", "@response", "@session", "@cookies", "@template", "@request_origin", "@parent_controller" ]
+ %w(@assigns @performed_redirect @performed_render
+ @request @response @_params @_session @session
+ @cookies @template @request_origin @parent_controller)
end
end
diff --git a/actionpack/lib/action_controller/pagination.rb b/actionpack/lib/action_controller/pagination.rb
index f7cd74120e..54084c0361 100644
--- a/actionpack/lib/action_controller/pagination.rb
+++ b/actionpack/lib/action_controller/pagination.rb
@@ -191,7 +191,7 @@ module ActionController
def paginator_and_collection_for(collection_id, options) #:nodoc:
klass = options[:class_name].constantize
- page = @params[options[:parameter]]
+ page = params[options[:parameter]]
count = count_collection_for_pagination(klass, options)
paginator = Paginator.new(self, count, options[:per_page], page)
collection = find_collection_for_pagination(klass, options, paginator)
diff --git a/actionpack/lib/action_controller/rescue.rb b/actionpack/lib/action_controller/rescue.rb
index 9b57d35587..7cd05eab32 100644
--- a/actionpack/lib/action_controller/rescue.rb
+++ b/actionpack/lib/action_controller/rescue.rb
@@ -79,7 +79,7 @@ module ActionController #:nodoc:
begin
perform_action_without_rescue
rescue Object => exception
- if defined?(Breakpoint) && @params["BP-RETRY"]
+ if defined?(Breakpoint) && params["BP-RETRY"]
msg = exception.backtrace.first
if md = /^(.+?):(\d+)(?::in `(.+)')?$/.match(msg) then
origin_file, origin_line = md[1], md[2].to_i
@@ -87,7 +87,7 @@ module ActionController #:nodoc:
set_trace_func(lambda do |type, file, line, method, context, klass|
if file == origin_file and line == origin_line then
set_trace_func(nil)
- @params["BP-RETRY"] = false
+ params["BP-RETRY"] = false
callstack = caller
callstack.slice!(0) if callstack.first["rescue.rb"]
diff --git a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
index 81995320c2..82007ff5e6 100644
--- a/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
+++ b/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
@@ -11,7 +11,7 @@
<%= form_tag(@request.request_uri, "method" => @request.method) %>
<input type="hidden" name="BP-RETRY" value="1" />
- <% for key, values in @params %>
+ <% for key, values in params %>
<% next if key == "BP-RETRY" %>
<% for value in Array(values) %>
<input type="hidden" name="<%= key %>" value="<%= value %>" />
diff --git a/actionpack/lib/action_controller/verification.rb b/actionpack/lib/action_controller/verification.rb
index 8e0b255f26..ebf30becac 100644
--- a/actionpack/lib/action_controller/verification.rb
+++ b/actionpack/lib/action_controller/verification.rb
@@ -76,8 +76,8 @@ module ActionController #:nodoc:
def verify_action(options) #:nodoc:
prereqs_invalid =
- [*options[:params] ].find { |v| @params[v].nil? } ||
- [*options[:session]].find { |v| @session[v].nil? } ||
+ [*options[:params] ].find { |v| params[v].nil? } ||
+ [*options[:session]].find { |v| session[v].nil? } ||
[*options[:flash] ].find { |v| flash[v].nil? }
if !prereqs_invalid && options[:method]
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb
index 13b2ef4821..b38501359c 100644
--- a/actionpack/lib/action_view/base.rb
+++ b/actionpack/lib/action_view/base.rb
@@ -148,7 +148,8 @@ module ActionView #:nodoc:
attr_accessor :base_path, :assigns, :template_extension
attr_accessor :controller
- attr_reader :logger, :params, :request, :response, :session, :headers, :flash
+ attr_reader :logger, :request, :response, :headers
+ attr_internal :flash, :params, :session
# Specify trim mode for the ERB compiler. Defaults to '-'.
# See ERB documentation for suitable values.