From 0049bd729f71c804b4c930e38269aa5a40cca158 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Sat, 29 Apr 2006 16:34:23 +0000 Subject: [PATCH] Update README git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4307 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/README | 10 ++++---- actionpack/lib/action_controller/base.rb | 32 +++++++++++++----------- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/actionpack/README b/actionpack/README index dc475a6610..88bcab8461 100755 --- a/actionpack/README +++ b/actionpack/README @@ -139,7 +139,7 @@ A short rundown of the major features: end Layout file (called weblog_layout): - <%= @content_for_layout %> + <%= yield %> Template for hello_world action:

Hello world

@@ -155,7 +155,7 @@ A short rundown of the major features: map.connect 'clients/:client_name/:project_name/:controller/:action' Accessing /clients/37signals/basecamp/project/dash calls ProjectController#dash with - { "client_name" => "37signals", "project_name" => "basecamp" } in @params["params"] + { "client_name" => "37signals", "project_name" => "basecamp" } in params[:params] From that URL, you can rewrite the redirect in a number of ways: @@ -338,7 +338,7 @@ A short rundown of the major features: - This form generates a @params["post"] array that can be used directly in a save action: + This form generates a params[:post] array that can be used directly in a save action: class WeblogController < ActionController::Base def save @@ -370,7 +370,7 @@ methods: end def display - @post = Post.find(:params[:id]) + @post = Post.find(params[:id]) end def new @@ -394,7 +394,7 @@ And the templates look like this: weblog/layout.rhtml: - <%= @content_for_layout %> + <%= yield %> weblog/index.rhtml: diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index f0997e3f6a..77e5bba692 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -373,24 +373,26 @@ module ActionController #:nodoc: def filter_parameter_logging(*filter_words, &block) parameter_filter = Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true) if filter_words.length > 0 - define_method(:filter_parameters) do |unfiltered_parameters| - filtered_parameters = {} + class << self + define_method(:filter_parameters) do |unfiltered_parameters| + filtered_parameters = {} - unfiltered_parameters.each do |key, value| - if key =~ parameter_filter - filtered_parameters[key] = '[FILTERED]' - elsif value.is_a?(Hash) - filtered_parameters[key] = filter_parameters(value) - elsif block_given? - key, value = key.dup, value.dup - yield key, value - filtered_parameters[key] = value - else - filtered_parameters[key] = value + unfiltered_parameters.each do |key, value| + if key =~ parameter_filter + filtered_parameters[key] = '[FILTERED]' + elsif value.is_a?(Hash) + filtered_parameters[key] = filter_parameters(value) + elsif block_given? + key, value = key.dup, value.dup + yield key, value + filtered_parameters[key] = value + else + filtered_parameters[key] = value + end end - end - filtered_parameters + filtered_parameters + end end end end