mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Update README
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4307 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
c745f47804
commit
0049bd729f
2 changed files with 22 additions and 20 deletions
|
@ -139,7 +139,7 @@ A short rundown of the major features:
|
||||||
end
|
end
|
||||||
|
|
||||||
Layout file (called weblog_layout):
|
Layout file (called weblog_layout):
|
||||||
<html><body><%= @content_for_layout %></body></html>
|
<html><body><%= yield %></body></html>
|
||||||
|
|
||||||
Template for hello_world action:
|
Template for hello_world action:
|
||||||
<h1>Hello world</h1>
|
<h1>Hello world</h1>
|
||||||
|
@ -155,7 +155,7 @@ A short rundown of the major features:
|
||||||
map.connect 'clients/:client_name/:project_name/:controller/:action'
|
map.connect 'clients/:client_name/:project_name/:controller/:action'
|
||||||
|
|
||||||
Accessing /clients/37signals/basecamp/project/dash calls ProjectController#dash with
|
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:
|
From that URL, you can rewrite the redirect in a number of ways:
|
||||||
|
|
||||||
|
@ -338,7 +338,7 @@ A short rundown of the major features:
|
||||||
<input type="submit" value="Create">
|
<input type="submit" value="Create">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
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
|
class WeblogController < ActionController::Base
|
||||||
def save
|
def save
|
||||||
|
@ -370,7 +370,7 @@ methods:
|
||||||
end
|
end
|
||||||
|
|
||||||
def display
|
def display
|
||||||
@post = Post.find(:params[:id])
|
@post = Post.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
||||||
def new
|
def new
|
||||||
|
@ -394,7 +394,7 @@ And the templates look like this:
|
||||||
|
|
||||||
weblog/layout.rhtml:
|
weblog/layout.rhtml:
|
||||||
<html><body>
|
<html><body>
|
||||||
<%= @content_for_layout %>
|
<%= yield %>
|
||||||
</body></html>
|
</body></html>
|
||||||
|
|
||||||
weblog/index.rhtml:
|
weblog/index.rhtml:
|
||||||
|
|
|
@ -373,24 +373,26 @@ module ActionController #:nodoc:
|
||||||
def filter_parameter_logging(*filter_words, &block)
|
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
|
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|
|
class << self
|
||||||
filtered_parameters = {}
|
define_method(:filter_parameters) do |unfiltered_parameters|
|
||||||
|
filtered_parameters = {}
|
||||||
|
|
||||||
unfiltered_parameters.each do |key, value|
|
unfiltered_parameters.each do |key, value|
|
||||||
if key =~ parameter_filter
|
if key =~ parameter_filter
|
||||||
filtered_parameters[key] = '[FILTERED]'
|
filtered_parameters[key] = '[FILTERED]'
|
||||||
elsif value.is_a?(Hash)
|
elsif value.is_a?(Hash)
|
||||||
filtered_parameters[key] = filter_parameters(value)
|
filtered_parameters[key] = filter_parameters(value)
|
||||||
elsif block_given?
|
elsif block_given?
|
||||||
key, value = key.dup, value.dup
|
key, value = key.dup, value.dup
|
||||||
yield key, value
|
yield key, value
|
||||||
filtered_parameters[key] = value
|
filtered_parameters[key] = value
|
||||||
else
|
else
|
||||||
filtered_parameters[key] = value
|
filtered_parameters[key] = value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
filtered_parameters
|
filtered_parameters
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue