Changeset 4715
- Timestamp:
- 08/07/06 12:40:14 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/examples/address_book_controller.rb (modified) (1 diff)
- trunk/actionpack/examples/blog_controller.cgi (modified) (1 diff)
- trunk/actionpack/examples/debate_controller.cgi (modified) (2 diffs)
- trunk/actionpack/lib/action_controller/base.rb (modified) (6 diffs)
- trunk/actionpack/lib/action_controller/pagination.rb (modified) (1 diff)
- trunk/actionpack/lib/action_controller/rescue.rb (modified) (2 diffs)
- trunk/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml (modified) (1 diff)
- trunk/actionpack/lib/action_controller/verification.rb (modified) (1 diff)
- trunk/actionpack/lib/action_view/base.rb (modified) (1 diff)
- trunk/actionpack/test/controller/action_pack_assertions_test.rb (modified) (1 diff)
- trunk/actionpack/test/controller/components_test.rb (modified) (1 diff)
- trunk/actionpack/test/controller/verification_test.rb (modified) (2 diffs)
- trunk/actionpack/test/template/deprecated_instance_variables_test.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r4713 r4715 3 3 * Add support for the param_name parameter to the auto_complete_field helper. #5026 [david.a.williams@gmail.com] 4 4 5 * Deprecation! @ session and @flash will be removed after 1.2. Use the session and flashmethods instead. You'll get printed warnings during tests and logged warnings in dev mode when you access either instance variable directly. [Jeremy Kemper]5 * Deprecation! @params, @session, @flash will be removed after 1.2. Use the corresponding instance methods instead. You'll get printed warnings during tests and logged warnings in dev mode when you access either instance variable directly. [Jeremy Kemper] 6 6 7 7 * Make Routing noisy when an anchor regexp is assigned to a segment. #5674 [francois.beausoleil@gmail.com] trunk/actionpack/examples/address_book_controller.rb
r4 r4715 29 29 30 30 def person 31 @person = @address_book.find_person( @params["id"])31 @person = @address_book.find_person(params[:id]) 32 32 end 33 33 34 34 def create_person 35 @address_book.create_person( @params["person"])35 @address_book.create_person(params[:person]) 36 36 redirect_to :action => "index" 37 37 end trunk/actionpack/examples/blog_controller.cgi
r4699 r4715 33 33 34 34 def create 35 @session["posts"].unshift(Post.new( @params["post"]["title"], @params["post"]["body"]))35 @session["posts"].unshift(Post.new(params[:post][:title], params[:post][:body])) 36 36 flash["alert"] = "New post added!" 37 37 redirect_to :action => "index" trunk/actionpack/examples/debate_controller.cgi
r4 r4715 26 26 27 27 def topic 28 @topic = @debate.find_topic( @params["id"])28 @topic = @debate.find_topic(params[:id]) 29 29 end 30 30 … … 32 32 33 33 def create_topic 34 @debate.create_topic( @params["topic"])34 @debate.create_topic(params[:topic]) 35 35 redirect_to :action => "index" 36 36 end 37 37 38 38 def create_reply 39 @debate.create_reply( @params["reply"])40 redirect_to :action => "topic", :path_params => { "id" => @params["reply"]["topic_id"] }39 @debate.create_reply(params[:reply]) 40 redirect_to :action => "topic", :path_params => { "id" => params[:reply][:topic_id] } 41 41 end 42 42 trunk/actionpack/lib/action_controller/base.rb
r4699 r4715 288 288 # <tt>request.env["REQUEST_URI"]</tt>. 289 289 attr_accessor :request 290 290 291 291 # Holds a hash of all the GET, POST, and Url parameters passed to the action. Accessed like <tt>params["post_id"]</tt> 292 292 # to get the post_id. No type casts are made, so all values are returned as strings. 293 attr_ accessor:params294 293 attr_internal :params 294 295 295 # Holds the response object that's primarily used to set additional HTTP headers through access like 296 296 # <tt>response.headers["Cache-Control"] = "no-cache"</tt>. Can also be used to access the final body HTML after a template … … 298 298 # such as a OutputCompressionFilter. 299 299 attr_accessor :response 300 300 301 301 # Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person" 302 302 # key. The session will hold any type of object as values, but the key should be a string or symbol. … … 933 933 934 934 def assign_shortcuts(request, response) 935 @request, @ params, @cookies = request, request.parameters, request.cookies935 @request, @_params, @cookies = request, request.parameters, request.cookies 936 936 937 937 @response = response … … 947 947 948 948 # TODO: assigns cookies headers params request response template 949 DEPRECATED_INSTANCE_VARIABLES = %w(flash session)949 DEPRECATED_INSTANCE_VARIABLES = %w(flash params session) 950 950 951 951 # Gone after 1.2. … … 1020 1020 1021 1021 def add_class_variables_to_assigns 1022 %w( template_root logger template_class ignore_missing_templates).each do |cvar|1022 %w(template_root logger template_class ignore_missing_templates).each do |cvar| 1023 1023 @assigns[cvar] = self.send(cvar) 1024 1024 end … … 1027 1027 def protected_instance_variables 1028 1028 if view_controller_internals 1029 [ "@assigns", "@performed_redirect", "@performed_render" ]1029 %w(@assigns @performed_redirect @performed_render) 1030 1030 else 1031 [ "@assigns", "@performed_redirect", "@performed_render", "@request", "@response", "@session", "@cookies", "@template", "@request_origin", "@parent_controller" ] 1031 %w(@assigns @performed_redirect @performed_render 1032 @request @response @_params @_session @session 1033 @cookies @template @request_origin @parent_controller) 1032 1034 end 1033 1035 end trunk/actionpack/lib/action_controller/pagination.rb
r4476 r4715 192 192 def paginator_and_collection_for(collection_id, options) #:nodoc: 193 193 klass = options[:class_name].constantize 194 page = @params[options[:parameter]]194 page = params[options[:parameter]] 195 195 count = count_collection_for_pagination(klass, options) 196 196 paginator = Paginator.new(self, count, options[:per_page], page) trunk/actionpack/lib/action_controller/rescue.rb
r4312 r4715 80 80 perform_action_without_rescue 81 81 rescue Object => exception 82 if defined?(Breakpoint) && @params["BP-RETRY"]82 if defined?(Breakpoint) && params["BP-RETRY"] 83 83 msg = exception.backtrace.first 84 84 if md = /^(.+?):(\d+)(?::in `(.+)')?$/.match(msg) then … … 88 88 if file == origin_file and line == origin_line then 89 89 set_trace_func(nil) 90 @params["BP-RETRY"] = false90 params["BP-RETRY"] = false 91 91 92 92 callstack = caller trunk/actionpack/lib/action_controller/templates/rescues/_request_and_response.rhtml
r3060 r4715 12 12 <input type="hidden" name="BP-RETRY" value="1" /> 13 13 14 <% for key, values in @params %>14 <% for key, values in params %> 15 15 <% next if key == "BP-RETRY" %> 16 16 <% for value in Array(values) %> trunk/actionpack/lib/action_controller/verification.rb
r4479 r4715 77 77 def verify_action(options) #:nodoc: 78 78 prereqs_invalid = 79 [*options[:params] ].find { |v| @params[v].nil? } ||80 [*options[:session]].find { |v| @session[v].nil? } ||79 [*options[:params] ].find { |v| params[v].nil? } || 80 [*options[:session]].find { |v| session[v].nil? } || 81 81 [*options[:flash] ].find { |v| flash[v].nil? } 82 82 trunk/actionpack/lib/action_view/base.rb
r4598 r4715 149 149 attr_accessor :controller 150 150 151 attr_reader :logger, :params, :request, :response, :session, :headers, :flash 151 attr_reader :logger, :request, :response, :headers 152 attr_internal :flash, :params, :session 152 153 153 154 # Specify trim mode for the ERB compiler. Defaults to '-'. trunk/actionpack/test/controller/action_pack_assertions_test.rb
r4404 r4715 55 55 56 56 def render_based_on_parameters 57 render_text "Mr. #{ @params["name"]}"57 render_text "Mr. #{params[:name]}" 58 58 end 59 59 trunk/actionpack/test/controller/components_test.rb
r4474 r4715 47 47 class CalleeController < ActionController::Base 48 48 def being_called 49 render_text "#{ @params["name"] || "Lady"} of the House, speaking"49 render_text "#{params[:name] || "Lady"} of the House, speaking" 50 50 end 51 51 trunk/actionpack/test/controller/verification_test.rb
r4201 r4715 35 35 36 36 def guarded_one 37 render :text => "#{ @params["one"]}"37 render :text => "#{params[:one]}" 38 38 end 39 39 40 40 def guarded_with_flash 41 render :text => "#{ @params["one"]}"41 render :text => "#{params[:one]}" 42 42 end 43 43 44 44 def guarded_two 45 render :text => "#{ @params["one"]}:#{@params["two"]}"45 render :text => "#{params[:one]}:#{params[:two]}" 46 46 end 47 47 … … 71 71 72 72 def unguarded 73 render :text => "#{ @params["one"]}"73 render :text => "#{params[:one]}" 74 74 end 75 75