public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
 r3022@ks:  jeremy | 2005-11-12 18:40:42 -0800
 merge to stable
 r3024@ks:  jeremy | 2005-11-12 19:00:49 -0800
 Apply [2992] to stable.  SQLite: the clone_structure_to_test and 
 purge_test_database Rake tasks should always use the test environment.  
 References #2846.
 r3027@ks:  jeremy | 2005-11-12 22:37:45 -0800
 Apply [2994] to stable.  PostgreSQL: correct the sequence discovery 
 fallback query.  References #2594.
 r3033@ks:  jeremy | 2005-11-12 23:27:13 -0800
 Apply [2996] to stable.  Much faster Oracle column reflection.  Closes 
 #2848.
 r3037@ks:  jeremy | 2005-11-13 00:11:26 -0800
 Apply [2998] to stable.  PostgreSQL: last_insert_id uses select_value 
 rather than using @connection.exec directly.
 r3053@ks:  jeremy | 2005-11-13 14:37:39 -0800
 Only include builtin filters whose filenames match 
 /^[a-z][a-z_]*_helper.rb$/ to avoid including operating system metadata 
 such as ._foo_helper.rb.  Closes #2855.
 r3055@ks:  jeremy | 2005-11-13 14:48:48 -0800
 Apply [3009] to stable:  Reapply [2942] which was elided by [2997].  
 References #2788.
 r3058@ks:  jeremy | 2005-11-13 16:09:17 -0800
 Apply [3013] to stable.  Note that the ruby-memcache bindings are 
 required to use the memcache store.  Closes #2857.
 r3063@ks:  jeremy | 2005-11-13 16:13:51 -0800
 Apply [3015] to stable.  Update documentation for render :file.  Closes 
 #2858.
 r3066@ks:  jeremy | 2005-11-13 20:24:18 -0800
 Apply [3017] to stable.  Update documentation for Migrations.  Closes 
 #2861.
 r3070@ks:  jeremy | 2005-11-13 20:54:50 -0800
 Apply [3019] to stable.  Oracle: test case for column default parsing.  
 Closes #2788.
 r3073@ks:  jeremy | 2005-11-13 23:42:32 -0800
 Apply [3021] to stable.  Correct documentation for Base.delete_all.  
 Closes #1568.
 r3077@ks:  jeremy | 2005-11-14 14:28:21 -0800
 Apply [3035] to stable.  SQLServer: insert uses given primary key value 
 if not nil rather than SELECT @@IDENTITY.  Closes #2866.
 r3120@ks:  jeremy | 2005-11-16 13:34:45 -0800
 Apply [3060] to stable.  Remove the unused, slow response_dump and 
 session_dump variables from error pages.  Closes #1222.
 r3130@ks:  jeremy | 2005-11-16 14:37:47 -0800
 Apply [3063] to stable.  Remove CHANGELOG from apidoc Rake task since it 
 isn't included with new apps anymore.
 r3148@ks:  jeremy | 2005-11-17 12:45:44 -0800
 Apply [3074] to stable.  Don't add the same conditions twice in has_one 
 finder sql.  Closes #2916.
 r3149@ks:  jeremy | 2005-11-17 12:47:36 -0800
 Apply [3075] to stable.  Document :force option to create_table.  Closes 
 #2921.
 r3157@ks:  jeremy | 2005-11-17 21:27:39 -0800
 Apply [3081] to stable.  Eliminate nil from newly generated logfiles.  
 Closes #2927.
 r3167@ks:  jeremy | 2005-11-18 22:47:31 -0800
 Apply [3089] to stable.  Don't generate read methods for columns whose 
 names are not valid ruby method names.  Closes #2946.
 r3174@ks:  jeremy | 2005-11-19 01:53:00 -0800
 Apply [3092] to stable.  Correct boolean handling in generated reader 
 methods.  Closes #2945.
 r3178@ks:  jeremy | 2005-11-19 01:59:47 -0800
 Apply [3094] to stable.  Use query methods rather than readers in boolean 
 tests for [3092].  References #2949.
 r3190@ks:  jeremy | 2005-11-19 20:20:48 -0800
 Apply [3098] to stable.  Introducing the session_migration generator.  
 Creates an add_session_table migration.  Closes #2958.
 r3199@ks:  jeremy | 2005-11-19 21:13:22 -0800
 Apply [3101] to stable.  Allows generator to specify migrations 
 directory.  Closes #2960.
 r3201@ks:  jeremy | 2005-11-19 21:31:47 -0800
 Apply [3103] to stable.  Document request.env and request.host.  Strip 
 trailing whitespace.
 r3258@ks:  jeremy | 2005-11-21 00:33:59 -0800
 Apply [3139] to stable.  Use Kernel.binding rather than binding to allow 
 columns of that name.  Closes #2973.
 r3269@ks:  jeremy | 2005-11-21 04:46:40 -0800
 Apply [3148] to stable.  Simpler Mysql load test.
 r3285@ks:  jeremy | 2005-11-22 13:33:04 -0800
 Apply [3162] to stable.  Model generator: correct relative path to 
 test_helper in unit test.
 r3296@ks:  jeremy | 2005-11-23 13:38:56 -0800
 Apply [3170] to stable.  Credit ticket author.  References #2888.
 r3303@ks:  jeremy | 2005-11-23 17:14:31 -0800
 Apply [3051], [3052], [3053], [3059] to stable.  Brings the Firebird 
 adapter to 1.0.  References #1874.
 r3305@ks:  jeremy | 2005-11-23 17:33:51 -0800
 Apply [3151] to stable.  Don't put flash in session if sessions are 
 disabled.
 r3306@ks:  jeremy | 2005-11-23 17:39:24 -0800
 Apply [3100], [3108] to stable.  Makes new ActiveRecordStore sessions 
 work correctly with components.
 r3307@ks:  jeremy | 2005-11-23 17:52:14 -0800
 Apply [3110] to stable.  PostgreSQL: the purge_test_database Rake task 
 shouldn't explicitly specify the template0 template when creating a fresh 
 test database.  References #2964.
 r3313@ks:  jeremy | 2005-11-23 23:03:36 -0800
 Apply [3182] to stable.  Reloading a model doesn't lose track of its 
 connection.  Closes #2996.
 r3315@ks:  jeremy | 2005-11-23 23:13:48 -0800
 Apply [3184] to stable.  SQLServer: resolve column aliasing/quoting 
 collision when using limit or offset in an eager find.  Closes #2974.
 r3339@ks:  jeremy | 2005-12-01 17:03:16 -0800
 Apply [3202] to stable.  Firebird: updated for FireRuby 0.4.0.  Closes 
 #3009.
 r3363@ks:  jeremy | 2005-12-06 22:26:27 -0800
 Apply #428 changesets to stable: r3000, r3001, r3002, r3025, r3045, 
 r3096, r3148, r3152, r3165, r3189, r3195, r3205, r3216, r3219, r3221, 
 r3222.  Closes #428.
 r3372@ks:  jeremy | 2005-12-07 20:25:20 -0800
 Apply [3233] to stable.  Oracle: use syntax compatible with Oracle 8.  
 Closes #3131.
 r3375@ks:  jeremy | 2005-12-07 20:36:13 -0800
 Apply [3235] to stable.  PostgreSQL: more robust sequence name discovery. 
  Closes #3087.
 r3378@ks:  jeremy | 2005-12-07 20:41:47 -0800
 Apply [3237] to stable.  More robust relative url root discovery for SCGI 
 compatibility.  This solves the 'SCGI routes problem' -- you no longer 
 need to prefix all your routes with the name of the SCGI mountpoint.  
 Closes #3070.
 r3379@ks:  jeremy | 2005-12-07 20:42:31 -0800
 Don't warn on keep_flash in test.
 r3387@ks:  jeremy | 2005-12-07 20:48:42 -0800
 Apply [3242] to stable.  Reloading an instance refreshes its aggregations 
 as well as its associations.  Closes #3024.
 r3389@ks:  jeremy | 2005-12-07 20:52:39 -0800
 Apply [3244] to stable.  SQLite: find database file when RAILS_ROOT is a 
 symlink.  Closes #3116.
 r3392@ks:  jeremy | 2005-12-07 21:10:42 -0800
 Apply [3246] to stable.  MySQL: more robust test for nullified result 
 hashes.  Closes #3124.
 r3401@ks:  jeremy | 2005-12-07 23:30:11 -0800
 Apply [3252] to stable.  Oracle: active? performs a select instead of a 
 commit.  Closes #3133.
 r3404@ks:  jeremy | 2005-12-08 15:24:44 -0800
 Apply [3254] to stable.  Fix some test failures due to MySQL assumptions. 
  References #3149.
 r3407@ks:  jeremy | 2005-12-09 10:39:00 -0800
 Apply [3256] to stable.  Generator copies files in binary mode.  Closes 
 #3156.
 r3410@ks:  jeremy | 2005-12-09 10:48:32 -0800
 Apply [3258] to stable.  Fix shebang handling for empty files.  Closes 
 #2927.
 r3413@ks:  jeremy | 2005-12-09 15:03:42 -0800
 Apply [3260] to stable.  Fix bundled mysql.rb to correctly check for 
 PROTO_41.  Fixed scramble41 with nil password.  Fixed change_user with 
 PROTO_41.
 r3416@ks:  jeremy | 2005-12-09 15:07:21 -0800
 Apply [3262] to stable.  Generator looks in vendor/generators also.
 r3419@ks:  jeremy | 2005-12-09 15:36:50 -0800
 Apply [3165] to stable. MySQL, PostgreSQL: reconnect! also reconfigures 
 the connection. Otherwise, the connection 'loses' its settings if it 
 times out and is reconnected. References #2978.
 r3420@ks:  jeremy | 2005-12-09 15:38:30 -0800
 Apply [3264] to stable.  MySQL: ensure that @config is set.
 r3421@ks:  jeremy | 2005-12-09 15:42:40 -0800
 Apply [3265] to stable.  Name vendor/generators source differently from 
 lib/generators source.
 r3429@ks:  jeremy | 2005-12-09 16:55:16 -0800
 Apply [3270] SQLServer rollup to stable.
 r3435@ks:  jeremy | 2005-12-10 13:40:43 -0800
 Apply [3274] to stable.  MySQL: fixes for the bundled mysql.rb driver.  
 Closes #3160.
 r3457@ks:  jeremy | 2005-12-13 08:52:39 -0800
 Apply [3293] to stable.  MySQL: allow encoding option for mysql.rb 
 driver.
 r3458@ks:  jeremy | 2005-12-13 09:33:50 -0800
 Roll back [3245] on stable.  References #3116.
 r3465@ks:  jeremy | 2005-12-13 10:15:33 -0800
 Apply [3298] to stable.  Don't used defined? on a scoped constant since 
 it results in a const_missing call.
 r3724@ks:  jeremy | 2006-02-09 10:13:41 -0800
 Apply [3554] to stable. PostgreSQL: correctly parse negative integer 
 column defaults. Closes #3776.
 r3730@ks:  jeremy | 2006-02-09 11:42:57 -0800
 Apply [3559] to stable. Closes #3581.
 r3846@ks:  jeremy | 2006-02-26 15:24:58 -0800
 silence test/unit whining DefaultsTest is empty
 r3847@ks:  jeremy | 2006-02-26 15:26:53 -0800
 Apply [3674] to stable. Closes #3591.
 r4960@ks:  jeremy | 2006-08-06 23:56:18 -0700
 Merged to stable: change the request.env example in AC::Base docs to a 
 var that exists (REMOTE_IP doesn't) and isn't already wrapped by a 
 request method (i.e. request.remote_ip). References #5113.
 r4961@ks:  jeremy | 2006-08-07 00:11:59 -0700
 Merged to stable: add :status option to send_data and send_file. Defaults 
 to '200 OK'. References #5243.
 r4962@ks:  jeremy | 2006-08-07 00:18:42 -0700
 Merged to stable: real files and symlinks should be treated the same when 
 compiling templates. References #5438.
 r4963@ks:  jeremy | 2006-08-07 00:26:42 -0700
 Merged to stable: Added ActionController.filter_parameter_logging that 
 makes it easy to remove passwords, credit card numbers, and other 
 sensitive information from being logged when a request is handled. 
 References #1897.
 r4964@ks:  jeremy | 2006-08-07 00:33:32 -0700
 Merged to stable: correct spurious documentation example code which 
 results in a SyntaxError. References [4210].
 r4965@ks:  jeremy | 2006-08-07 00:38:04 -0700
 Merged to stable: remote_form_for can leave out the object parameter and 
 default to the instance variable of the object_name, just like form_for. 
 References [4215].
 r4966@ks:  jeremy | 2006-08-07 00:48:40 -0700
 Merged to stable: update inconsistent migrations documentation. 
 References #4683.
 r4967@ks:  jeremy | 2006-08-07 00:52:34 -0700
 Merge to stable: cache CgiRequest#request_parameters so that multiple 
 calls don't re-parse multipart data. References [4256].
 r4968@ks:  jeremy | 2006-08-07 00:55:51 -0700
 Merge to stable: only require redcloth/bluecloth if they are not already 
 loaded. References [4257].
 r4977@ks:  jeremy | 2006-08-07 01:08:02 -0700
 Merge to stable: skip silence stderr test if we can't STDERR.tell
 r4978@ks:  jeremy | 2006-08-07 01:13:00 -0700
 Merge to stable: update layout and content_for documentation to use yield 
 rather than magic @content_for_layout instance variables. References 
 [4263].
 r4979@ks:  jeremy | 2006-08-07 01:16:43 -0700
 Merge to stable: add documentation for redirect_to :back's 
 RedirectBackError exception; remove all remaining references to @params 
 in the documentation. References [4267], [4268].
 r4980@ks:  jeremy | 2006-08-07 01:18:04 -0700
 Merge to stable: fix documentation indentation.
 r4981@ks:  jeremy | 2006-08-07 01:28:34 -0700
 Merge to stable: mention in docs that config.frameworks doesn't work when 
 getting Rails via Gems; documentation for AbstractRequest.  References 
 #4857, #4895.
 r4982@ks:  jeremy | 2006-08-07 01:45:26 -0700
 Merge to stable: fix syntax error in documentation. References #4679.
 r4983@ks:  jeremy | 2006-08-07 01:50:47 -0700
 Merge to stable: Enhance documentation for setting headers in integration 
 tests. Skip auto HTTP prepending when its already there. References 
 #4079.  Add warning about the proper way to validate the presence of a 
 foreign key. References #4147.
 r4984@ks:  jeremy | 2006-08-07 02:08:00 -0700
 Merge to stable: ActionController::Base Summary documentation rewrite; 
 Fix text_helper.rb documentation rendering; Fixes bad rendering of 
 JavaScriptMacrosHelper rdoc.  References #4725, #4900, #4910.
 r4985@ks:  jeremy | 2006-08-07 02:14:18 -0700
 Merge to stable: documentation fix: integration test scripts don't 
 require integration_test. References #4914.


git-svn-id: http://svn-commit.rubyonrails.org/rails/branches/stable@4708 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
jeremy (author)
Mon Aug 07 02:25:21 -0700 2006
commit  94a1758f8202eee65f167337541d102d1faeaad2
tree    76269e6f71a8e4b2bc1be9821fc795f191ba96e0
parent  140e85c7246bf21613f6af1cee6d113dddfa552f
...
 
 
 
 
1
 
2
3
4
...
1
2
3
4
5
6
7
8
9
0
@@ -1,4 +1,9 @@
0
+*SVN*
0
+
0
+* Correct spurious documentation example code which results in a SyntaxError. [Marcel Molina Jr.]
0
+
0
 * Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com]
0
+
0
 
0
 *1.2.3* (June 29th, 2006)
0
 
...
14
15
16
17
 
18
19
20
...
14
15
16
 
17
18
19
20
0
@@ -14,7 +14,7 @@
0
   # def signup_notification(recipient)
0
   # recipients recipient.email_address_with_name
0
   # subject "New account information"
0
- # body { "account" => recipient }
0
+ # body "account" => recipient
0
   # from "system@example.com"
0
   # end
0
   #
...
1
2
 
3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
5
6
7
8
 
 
9
10
11
...
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
 
35
36
37
38
39
0
@@ -1,11 +1,39 @@
0
-*1.12.3* (June 28th, 2006)
0
-=======
0
+*SVN*
0
 
0
+* Documentation fix: integration test scripts don't require integration_test. #4914 [Frederick Ros <sl33p3r@free.fr>]
0
+
0
+* ActionController::Base Summary documentation rewrite. #4900 [kevin.clark@gmail.com]
0
+
0
+* Fix text_helper.rb documentation rendering. #4725 [Frederick Ros]
0
+
0
+* Fixes bad rendering of JavaScriptMacrosHelper rdoc. #4910 [Frederick Ros]
0
+
0
+* Enhance documentation for setting headers in integration tests. Skip auto HTTP prepending when its already there. #4079 [Rick Olson]
0
+
0
+* Documentation for AbstractRequest. #4895 [kevin.clark@gmail.com]
0
+
0
+* Remove all remaining references to @params in the documentation. [Marcel Molina Jr.]
0
+
0
+* Add documentation for redirect_to :back's RedirectBackError exception. [Marcel Molina Jr.]
0
+
0
+* Update layout and content_for documentation to use yield rather than magic @content_for instance variables. [Marcel Molina Jr.]
0
+
0
+* Cache CgiRequest#request_parameters so that multiple calls don't re-parse multipart data. [Rick]
0
+
0
+* Fixed that remote_form_for can leave out the object parameter and default to the instance variable of the object_name, just like form_for [DHH]
0
+
0
+* Added ActionController.filter_parameter_logging that makes it easy to remove passwords, credit card numbers, and other sensitive information from being logged when a request is handled. #1897 [jeremye@bsa.ca.gov]
0
+
0
+* Fixed that real files and symlinks should be treated the same when compiling templates. #5438 [zachary@panandscan.com]
0
+
0
+* Add :status option to send_data and send_file. Defaults to '200 OK'. #5243 [Manfred Stienstra <m.stienstra@fngtps.com>]
0
+
0
 * Update documentation for erb trim syntax. #5651 [matt@mattmargolis.net]
0
 
0
 * Short documentation to mention use of Mime::Type.register. #5710 [choonkeat@gmail.com]
0
 
0
-* Pass :id => nil or :class => nil to error_messages_for to supress that html attribute. #3586 [olivier_ansaldi@yahoo.com, sebastien@goetzilla.info]
0
+
0
+*1.12.3* (June 28th, 2006)
0
 
0
 * Fix broken traverse_to_controller. We now:
0
   Look for a _controller.rb file under RAILS_ROOT to load.
...
46
47
48
49
50
 
 
 
 
 
 
51
52
53
...
46
47
48
 
 
49
50
51
52
53
54
55
56
57
0
@@ -46,8 +46,12 @@
0
   rdoc.title = "Action Pack -- On rails from request to response"
0
   rdoc.options << '--line-numbers' << '--inline-source'
0
   rdoc.template = "#{ENV['template']}.rb" if ENV['template']
0
- rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
0
- rdoc.rdoc_files.include('lib/**/*.rb')
0
+ if ENV['DOC_FILES']
0
+ rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
0
+ else
0
+ rdoc.rdoc_files.include('README', 'RUNNING_UNIT_TESTS', 'CHANGELOG')
0
+ rdoc.rdoc_files.include('lib/**/*.rb')
0
+ end
0
 }
0
 
0
 # Create compressed packages
...
49
50
51
52
53
54
 
 
 
55
 
 
56
57
58
 
59
60
61
62
63
64
...
64
65
66
67
68
 
 
 
69
70
71
72
 
 
 
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
...
94
95
96
97
98
99
 
 
 
100
101
102
103
104
105
106
 
 
 
107
108
109
110
...
116
117
118
119
 
120
121
122
123
124
 
125
126
127
128
129
...
129
130
131
132
133
134
135
136
137
138
 
 
 
 
 
 
 
 
 
 
 
139
140
141
142
 
143
144
145
...
161
162
163
164
165
166
 
 
 
167
168
169
170
171
172
...
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
 
 
 
190
191
192
193
194
195
 
 
 
 
 
 
 
 
 
196
197
 
198
199
200
201
202
203
...
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
...
263
264
265
266
 
267
268
269
 
270
271
272
...
366
367
368
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
369
370
371
...
803
804
805
 
 
 
 
806
807
808
...
901
902
903
904
 
905
906
907
...
49
50
51
 
 
 
52
53
54
55
56
57
58
59
 
60
61
62
63
64
65
66
...
66
67
68
 
 
69
70
71
72
 
 
 
73
74
75
76
 
 
 
 
77
78
79
 
 
 
 
 
 
80
81
82
83
...
87
88
89
 
 
 
90
91
92
93
94
95
96
 
 
 
97
98
99
100
101
102
103
...
109
110
111
 
112
113
114
115
116
 
117
118
119
120
121
122
...
122
123
124
 
 
 
 
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
 
142
143
144
145
...
161
162
163
 
 
 
164
165
166
167
168
169
170
171
172
...
171
172
173
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
175
176
177
 
 
 
 
 
178
179
180
181
182
183
184
185
186
187
 
188
189
 
 
190
191
192
...
203
204
205
 
 
 
 
 
 
 
 
 
206
207
208
209
...
243
244
245
 
246
247
248
 
249
250
251
252
...
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
...
830
831
832
833
834
835
836
837
838
839
...
932
933
934
 
935
936
937
938
0
@@ -49,13 +49,15 @@
0
     end
0
   end
0
 
0
- # Action Controllers are made up of one or more actions that performs its purpose and then either renders a template or
0
- # redirects to another action. An action is defined as a public method on the controller, which will automatically be
0
- # made accessible to the web-server through a mod_rewrite mapping. A sample controller could look like this:
0
+ # Action Controllers are the core of a web request in Rails. They are made up of one or more actions that are executed
0
+ # on request and then either render a template or redirect to another action. An action is defined as a public method
0
+ # on the controller, which will automatically be made accessible to the web-server through Rails Routes.
0
   #
0
+ # A sample controller could look like this:
0
+ #
0
   # class GuestBookController < ActionController::Base
0
   # def index
0
- # @entries = Entry.find_all
0
+ # @entries = Entry.find(:all)
0
   # end
0
   #
0
   # def sign
0
0
0
0
@@ -64,26 +66,17 @@
0
   # end
0
   # end
0
   #
0
- # GuestBookController.template_root = "templates/"
0
- # GuestBookController.process_cgi
0
+ # Actions, by default, render a template in the <tt>app/views</tt> directory corresponding to the name of the controller and action
0
+ # after executing code in the action. For example, the +index+ action of the +GuestBookController+ would render the
0
+ # template <tt>app/views/guestbook/index.rhtml</tt> by default after populating the <tt>@entries</tt> instance variable.
0
   #
0
- # All actions assume that you want to render a template matching the name of the action at the end of the performance
0
- # unless you tell it otherwise. The index action complies with this assumption, so after populating the @entries instance
0
- # variable, the GuestBookController will render "templates/guestbook/index.rhtml".
0
+ # Unlike index, the sign action will not render a template. After performing its main purpose (creating a
0
+ # new entry in the guest book), it initiates a redirect instead. This redirect works by returning an external
0
+ # "302 Moved" HTTP response that takes the user to the index action.
0
   #
0
- # Unlike index, the sign action isn't interested in rendering a template. So after performing its main purpose (creating a
0
- # new entry in the guest book), it sheds the rendering assumption and initiates a redirect instead. This redirect works by
0
- # returning an external "302 Moved" HTTP response that takes the user to the index action.
0
- #
0
   # The index and sign represent the two basic action archetypes used in Action Controllers. Get-and-show and do-and-redirect.
0
   # Most actions are variations of these themes.
0
   #
0
- # Also note that it's the final call to <tt>process_cgi</tt> that actually initiates the action performance. It will extract
0
- # request and response objects from the CGI
0
- #
0
- # When Action Pack is used inside of Rails, the template_root is automatically configured and you don't need to call process_cgi
0
- # yourself.
0
- #
0
   # == Requests
0
   #
0
   # Requests are processed by the Action Controller framework by extracting the value of the "action" key in the request parameters.
0
0
@@ -94,16 +87,16 @@
0
   # The full request object is available with the request accessor and is primarily used to query for http headers. These queries
0
   # are made by accessing the environment hash, like this:
0
   #
0
- # def hello_ip
0
- # location = request.env["REMOTE_IP"]
0
- # render :text => "Hello stranger from #{location}"
0
+ # def server_ip
0
+ # location = request.env["SERVER_ADDR"]
0
+ # render :text => "This server hosted at #{location}"
0
   # end
0
   #
0
   # == Parameters
0
   #
0
- # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params hash.
0
- # So an action that was performed through /weblog/list?category=All&limit=5 will include { "category" => "All", "limit" => 5 }
0
- # in params.
0
+ # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params method
0
+ # which returns a hash. For example, an action that was performed through <tt>/weblog/list?category=All&limit=5</tt> will include
0
+ # <tt>{ "category" => "All", "limit" => 5 }</tt> in params.
0
   #
0
   # It's also possible to construct multi-dimensional parameter hashes by specifying keys using brackets, such as:
0
   #
0
0
@@ -116,12 +109,12 @@
0
   #
0
   # == Sessions
0
   #
0
- # Sessions allows you to store objects in memory between requests. This is useful for objects that are not yet ready to be persisted,
0
+ # Sessions allows you to store objects in between requests. This is useful for objects that are not yet ready to be persisted,
0
   # such as a Signup object constructed in a multi-paged process, or objects that don't change much and are needed all the time, such
0
   # as a User object for a system that requires login. The session should not be used, however, as a cache for objects where it's likely
0
   # they could be changed unknowingly. It's usually too much work to keep it all synchronized -- something databases already excel at.
0
   #
0
- # You can place objects in the session by using the <tt>session</tt> hash accessor:
0
+ # You can place objects in the session by using the <tt>session</tt> method, which accesses a hash:
0
   #
0
   # session[:person] = Person.authenticate(user_name, password)
0
   #
0
0
0
@@ -129,17 +122,24 @@
0
   #
0
   # Hello #{session[:person]}
0
   #
0
- # Any object can be placed in the session (as long as it can be Marshalled). But remember that 1000 active sessions each storing a
0
- # 50kb object could lead to a 50MB memory overhead. In other words, think carefully about size and caching before resorting to the use
0
- # of the session.
0
- #
0
   # For removing objects from the session, you can either assign a single key to nil, like <tt>session[:person] = nil</tt>, or you can
0
   # remove the entire session with reset_session.
0
   #
0
+ # By default, sessions are stored on the file system in <tt>RAILS_ROOT/tmp/sessions</tt>. Any object can be placed in the session
0
+ # (as long as it can be Marshalled). But remember that 1000 active sessions each storing a 50kb object could lead to a 50MB store on the filesystem.
0
+ # In other words, think carefully about size and caching before resorting to the use of the session on the filesystem.
0
+ #
0
+ # An alternative to storing sessions on disk is to use ActiveRecordStore to store sessions in your database, which can solve problems
0
+ # caused by storing sessions in the file system and may speed up your application. To use ActiveRecordStore, uncomment the line:
0
+ #
0
+ # config.action_controller.session_store = :active_record_store
0
+ #
0
+ # in your <tt>environment.rb</tt> and run <tt>rake db:sessions:create</tt>.
0
+ #
0
   # == Responses
0
   #
0
   # Each action results in a response, which holds the headers and document to be sent to the user's browser. The actual response
0
- # object is generated automatically through the use of renders and redirects, so it's normally nothing you'll need to be concerned about.
0
+ # object is generated automatically through the use of renders and redirects and requires no user intervention.
0
   #
0
   # == Renders
0
   #
0
@@ -161,9 +161,9 @@
0
   # def search
0
   # @results = Search.find(params[:query])
0
   # case @results
0
- # when 0 then render :action=> "no_results"
0
- # when 1 then render :action=> "show"
0
- # when 2..10 then render :action=> "show_many"
0
+ # when 0 then render :action => "no_results"
0
+ # when 1 then render :action => "show"
0
+ # when 2..10 then render :action => "show_many"
0
   # end
0
   # end
0
   #
0
0
0
0
@@ -171,33 +171,22 @@
0
   #
0
   # == Redirects
0
   #
0
- # Redirecting is what actions that update the model do when they're done. The <tt>save_post</tt> method shouldn't be responsible for also
0
- # showing the post once it's saved -- that's the job for <tt>show_post</tt>. So once <tt>save_post</tt> has completed its business, it'll
0
- # redirect to <tt>show_post</tt>. All redirects are external, which means that when the user refreshes his browser, it's not going to save
0
- # the post again, but rather just show it one more time.
0
- #
0
- # This sounds fairly simple, but the redirection is complicated by the quest for a phenomenon known as "pretty urls". Instead of accepting
0
- # the dreadful being that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as
0
- # "/weblog/show/5". And this is even the simple case. As an example of a more advanced pretty url consider
0
- # "/library/books/ISBN/0743536703/show", which can be mapped to books_controller?action=show&type=ISBN&id=0743536703.
0
- #
0
- # Redirects work by rewriting the URL of the current action. So if the show action was called by "/library/books/ISBN/0743536703/show",
0
- # we can redirect to an edit action simply by doing <tt>redirect_to(:action => "edit")</tt>, which could throw the user to
0
- # "/library/books/ISBN/0743536703/edit". Naturally, you'll need to setup the routes configuration file to point to the proper controller
0
- # and action in the first place, but once you have, it can be rewritten with ease.
0
- #
0
- # Let's consider a bunch of examples on how to go from "/clients/37signals/basecamp/project/dash" to somewhere else:
0
+ # Redirects are used to move from one action to another. For example, after a <tt>create</tt> action, which stores a blog entry to a database,
0
+ # we might like to show the user the new entry. Because we're following good DRY principles (Don't Repeat Yourself), we're going to reuse (and redirect to)
0
+ # a <tt>show</tt> action that we'll assume has already been created. The code might look like this:
0
   #
0
- # redirect_to(:action => "edit") =>
0
- # /clients/37signals/basecamp/project/dash
0
- #
0
- # redirect_to(:client_name => "nextangle", :project_name => "rails") =>
0
- # /clients/nextangle/rails/project/dash
0
+ # def create
0
+ # @entry = Entry.new(params[:entry])
0
+ # if @entry.save
0
+ # # The entry was saved correctly, redirect to show
0
+ # redirect_to :action => 'show', :id => @entry.id
0
+ # else
0
+ # # things didn't go so well, do something else
0
+ # end
0
+ # end
0
   #
0
- # Those redirects happen under the configuration of:
0
+ # In this case, after saving our new entry to the database, the user is redirected to the <tt>show</tt> method which is then executed.
0
   #
0
- # map.connect 'clients/:client_name/:project_name/:controller/:action'
0
- #
0
   # == Calling multiple redirects or renders
0
   #
0
   # An action should conclude with a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError:
0
@@ -214,15 +203,6 @@
0
   # render :action => "overthere" # won't be called unless monkeys is nil
0
   # end
0
   #
0
- # == Environments
0
- #
0
- # Action Controller works out of the box with CGI, FastCGI, and mod_ruby. CGI and mod_ruby controllers are triggered just the same using:
0
- #
0
- # WeblogController.process_cgi
0
- #
0
- # FastCGI controllers are triggered using:
0
- #
0
- # FCGI.each_cgi{ |cgi| WeblogController.process_cgi(cgi) }
0
   class Base
0
     DEFAULT_RENDER_STATUS_CODE = "200 OK"
0
     
0
0
@@ -263,10 +243,10 @@
0
 
0
     # Modern REST web services often need to submit complex data to the web application.
0
     # The param_parsers hash lets you register handlers wich will process the http body and add parameters to the
0
- # @params hash. These handlers are invoked for post and put requests.
0
+ # <tt>params</tt> hash. These handlers are invoked for post and put requests.
0
     #
0
     # By default application/xml is enabled. A XmlSimple class with the same param name as the root will be instanciated
0
- # in the @params. This allows XML requests to mask themselves as regular form submissions, so you can have one
0
+ # in the <tt>params</tt>. This allows XML requests to mask themselves as regular form submissions, so you can have one
0
     # action serve both regular forms and web service requests.
0
     #
0
     # Example of doing your own parser for a custom content type:
0
@@ -366,6 +346,53 @@
0
       def hide_action(*names)
0
         write_inheritable_attribute(:hidden_actions, hidden_actions | names.collect { |n| n.to_s })
0
       end
0
+
0
+ # Replace sensitive paramater data from the request log.
0
+ # Filters paramaters that have any of the arguments as a substring.
0
+ # Looks in all subhashes of the param hash for keys to filter.
0
+ # If a block is given, each key and value of the paramater hash and all
0
+ # subhashes is passed to it, the value or key
0
+ # can be replaced using String#replace or similar method.
0
+ #
0
+ # Examples:
0
+ # filter_parameter_logging
0
+ # => Does nothing, just slows the logging process down
0
+ #
0
+ # filter_parameter_logging :password
0
+ # => replaces the value to all keys matching /password/i with "[FILTERED]"
0
+ #
0
+ # filter_parameter_logging :foo, "bar"
0
+ # => replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
0
+ #
0
+ # filter_parameter_logging { |k,v| v.reverse! if k =~ /secret/i }
0
+ # => reverses the value to all keys matching /secret/i
0
+ #
0
+ # filter_parameter_logging(:foo, "bar") { |k,v| v.reverse! if k =~ /secret/i }
0
+ # => reverses the value to all keys matching /secret/i, and
0
+ # replaces the value to all keys matching /foo|bar/i with "[FILTERED]"
0
+ def filter_parameter_logging(*filter_words, &block)
0
+ parameter_filter = Regexp.new(filter_words.collect{ |s| s.to_s }.join('|'), true) if filter_words.length > 0
0
+
0
+ define_method(:filter_parameters) do |unfiltered_parameters|
0
+ filtered_parameters = {}
0
+
0
+ unfiltered_parameters.each do |key, value|
0
+ if key =~ parameter_filter
0
+ filtered_parameters[key] = '[FILTERED]'
0
+ elsif value.is_a?(Hash)
0
+ filtered_parameters[key] = filter_parameters(value)
0
+ elsif block_given?
0
+ key, value = key.dup, value.dup
0
+ yield key, value
0
+ filtered_parameters[key] = value
0
+ else
0
+ filtered_parameters[key] = value
0
+ end
0
+ end
0
+
0
+ filtered_parameters
0
+ end
0
+ end
0
     end
0
 
0
     public
0
@@ -803,6 +830,10 @@
0
       # redirect_to :back
0
       #
0
       # The redirection happens as a "302 Moved" header.
0
+ #
0
+ # When using <tt>redirect_to :back</tt>, if there is no referrer,
0
+ # RedirectBackError will be raised. You may specify some fallback
0
+ # behavior for this case by rescueing RedirectBackError.
0
       def redirect_to(options = {}, *parameters_for_method_reference) #:doc:
0
         case options
0
           when %r{^\w+://.*}
0
@@ -901,7 +932,7 @@
0
         if logger
0
           logger.info "\n\nProcessing #{controller_class_name}\##{action_name} (for #{request_origin}) [#{request.method.to_s.upcase}]"
0
           logger.info " Session ID: #{@session.session_id}" if @session and @session.respond_to?(:session_id)
0
- logger.info " Parameters: #{@params.inspect}"
0
+ logger.info " Parameters: #{respond_to?(:filter_parameters) ? filter_parameters(@params).inspect : @params.inspect}"
0
         end
0
       end
0
     
...
38
39
40
41
42
43
 
 
 
44
45
46
...
38
39
40
 
 
 
41
42
43
44
45
46
0
@@ -38,9 +38,9 @@
0
     #
0
     # class WeblogController < ActionController::Base
0
     # def update
0
- # List.update(@params["list"]["id"], @params["list"])
0
- # expire_page :action => "show", :id => @params["list"]["id"]
0
- # redirect_to :action => "show", :id => @params["list"]["id"]
0
+ # List.update(params[:list][:id], params[:list])
0
+ # expire_page :action => "show", :id => params[:list][:id]
0
+ # redirect_to :action => "show", :id => params[:list][:id]
0
     # end
0
     # end
0
     #
...
64
65
66
67
68
69
70
71
 
 
 
 
 
 
72
73
74
...
64
65
66
 
 
 
 
 
67
68
69
70
71
72
73
74
75
0
@@ -64,11 +64,12 @@
0
     end
0
 
0
     def request_parameters
0
- if ActionController::Base.param_parsers.has_key?(content_type)
0
- CGIMethods.parse_formatted_request_parameters(content_type, @env['RAW_POST_DATA'])
0
- else
0
- CGIMethods.parse_request_parameters(@cgi.params)
0
- end
0
+ @request_parameters ||=
0
+ if ActionController::Base.param_parsers.has_key?(content_type)
0
+ CGIMethods.parse_formatted_request_parameters(content_type, @env['RAW_POST_DATA'])
0
+ else
0
+ CGIMethods.parse_request_parameters(@cgi.params)
0
+ end
0
     end
0
    
0
     def cookies
...
140
141
142
143
 
 
 
144
145
146
147
148
149
150
 
 
 
151
152
153
...
155
156
157
158
 
 
 
159
160
161
...
218
219
220
221
 
222
223
224
...
341
342
343
344
345
346
347
...
366
367
368
369
370
371
372
...
140
141
142
 
143
144
145
146
147
148
149
150
151
 
152
153
154
155
156
157
...
159
160
161
 
162
163
164
165
166
167
...
224
225
226
 
227
228
229
230
...
347
348
349
 
350
351
352
...
371
372
373
 
374
375
376
0
@@ -140,14 +140,18 @@
0
 
0
       # Performs a GET request with the given parameters. The parameters may
0
       # be +nil+, a Hash, or a string that is appropriately encoded
0
- # (application/x-www-form-urlencoded or multipart/form-data).
0
+ # (application/x-www-form-urlencoded or multipart/form-data). The headers
0
+ # should be a hash. The keys will automatically be upcased, with the
0
+ # prefix 'HTTP_' added if needed.
0
       def get(path, parameters=nil, headers=nil)
0
         process :get, path, parameters, headers
0
       end
0
 
0
       # Performs a POST request with the given parameters. The parameters may
0
       # be +nil+, a Hash, or a string that is appropriately encoded
0
- # (application/x-www-form-urlencoded or multipart/form-data).
0
+ # (application/x-www-form-urlencoded or multipart/form-data). The headers
0
+ # should be a hash. The keys will automatically be upcased, with the
0
+ # prefix 'HTTP_' added if needed.
0
       def post(path, parameters=nil, headers=nil)
0
         process :post, path, parameters, headers
0
       end
0
@@ -155,7 +159,9 @@
0
       # Performs an XMLHttpRequest request with the given parameters, mimicing
0
       # the request environment created by the Prototype library. The parameters
0
       # may be +nil+, a Hash, or a string that is appropriately encoded
0
- # (application/x-www-form-urlencoded or multipart/form-data).
0
+ # (application/x-www-form-urlencoded or multipart/form-data). The headers
0
+ # should be a hash. The keys will automatically be upcased, with the
0
+ # prefix 'HTTP_' added if needed.
0
       def xml_http_request(path, parameters=nil, headers=nil)
0
         headers = (headers || {}).merge("X-Requested-With" => "XMLHttpRequest")
0
         post(path, parameters, headers)
0
@@ -218,7 +224,7 @@
0
 
0
           (headers || {}).each do |key, value|
0
             key = key.to_s.upcase.gsub(/-/, "_")
0
- key = "HTTP_#{key}" unless env.has_key?(key)
0
+ key = "HTTP_#{key}" unless env.has_key?(key) || env =~ /^X|HTTP/
0
             env[key] = value
0
           end
0
 
0
@@ -341,7 +347,6 @@
0
   # using the get/post methods:
0
   #
0
   # require "#{File.dirname(__FILE__)}/test_helper"
0
- # require "integration_test"
0
   #
0
   # class ExampleTest < ActionController::IntegrationTest
0
   # fixtures :people
0
@@ -366,7 +371,6 @@
0
   # reference any named routes you happen to have defined!
0
   #
0
   # require "#{File.dirname(__FILE__)}/test_helper"
0
- # require "integration_test"
0
   #
0
   # class AdvancedTest < ActionController::IntegrationTest
0
   # fixtures :people, :rooms
...
27
28
29
30
 
31
32
33
...
47
48
49
50
 
51
52
53
54
...
159
160
161
 
 
 
162
163
164
165
 
 
166
167
168
...
27
28
29
 
30
31
32
33
...
47
48
49
 
50
51
52
53
54
...
159
160
161
162
163
164
165
 
 
 
166
167
168
169
170
0
@@ -27,7 +27,7 @@
0
     # that the header and footer are only mentioned in one place, like this:
0
     #
0
     # <!-- The header part of this layout -->
0
- # <%= @content_for_layout %>
0
+ # <%= yield %>
0
 &n