public
Description: Repository for improving Rails documentation
Homepage: http://www.rubyonrails.org
Clone URL: git://github.com/lifo/doc-rails.git
Search Repo:
Newly added TestProcess and TestResponse documentation.
metaskills (author)
Wed Apr 23 16:56:50 -0700 2008
commit  4c65d4cc3c83de8a5eb62def9f64d1af66f23db9
tree    ce16b6cd8450154c933abbfb947431c0254101a4
parent  4dfb9d83e925ff9812d9c7e52c14fed9baed2b82
...
222
223
224
225
 
226
227
228
229
230
 
 
 
 
231
232
233
234
235
 
236
237
238
239
240
 
 
 
 
 
241
242
243
244
 
245
246
247
...
259
260
261
262
 
263
264
265
...
411
412
413
414
 
 
 
 
 
415
416
417
418
419
420
...
419
420
421
422
 
 
423
424
425
426
 
 
427
428
429
430
 
 
431
432
433
434
 
 
435
436
437
...
222
223
224
 
225
226
227
228
229
 
230
231
232
233
234
235
236
237
 
238
239
240
241
 
 
242
243
244
245
246
247
248
249
 
250
251
252
253
...
265
266
267
 
268
269
270
271
...
417
418
419
 
420
421
422
423
424
425
426
427
428
429
430
...
429
430
431
 
432
433
434
435
436
 
437
438
439
440
441
 
442
443
444
445
446
 
447
448
449
450
451
0
@@ -222,26 +222,32 @@
0
       !rendered_file.nil?
0
     end
0
 
0
- # A shortcut to the flash. Returns an empyt hash if no session flash exists.
0
+ # A shortcut to the flash. Returns an empty hash if no session flash exists.
0
     def flash
0
       session['flash'] || {}
0
     end
0
 
0
- # Do we have a flash?
0
+ # Returns true if the flash is not empty, otherwise false.
0
+ #
0
+ # flash[:user_id] = 1
0
+ # assert @response.has_flash?
0
     def has_flash?
0
       !session['flash'].empty?
0
     end
0
 
0
- # Do we have a flash that has contents?
0
+ # Currently identical to <tt>has_flash?</tt>.
0
     def has_flash_with_contents?
0
       !flash.empty?
0
     end
0
-
0
- # Does the specified flash object exist?
0
+
0
+ # Returns true if the key +name+ of the flash hash does not return a nil value.
0
+ #
0
+ # flash[:transient_data] = 'Something'
0
+ # assert @response.has_flash_object?(:transient_data)
0
     def has_flash_object?(name=nil)
0
       !flash[name].nil?
0
     end
0
-
0
+
0
     # Does the specified object exist in the session?
0
     def has_session_object?(name=nil)
0
       !session[name].nil?
0
@@ -259,7 +265,7 @@
0
 
0
     # Returns the response cookies, converted to a Hash of (name => CGI::Cookie) pairs
0
     #
0
- # assert_equal ['AuthorOfNewPage'], r.cookies['author'].value
0
+ # assert_equal ['AuthorOfNewPage'], @response.cookies['author'].value
0
     def cookies
0
       headers['cookie'].inject({}) { |hash, cookie| hash[cookie.name] = cookie; hash }
0
     end
0
@@ -411,7 +417,11 @@
0
 
0
       get(@response.redirected_to.delete(:action), @response.redirected_to.stringify_keys)
0
     end
0
-
0
+
0
+ # Instance variables assigned in the action that are available for the view can
0
+ # be accessed throught this method using the +key+ as the index to the assigns hash.
0
+ #
0
+ # assert_not_nil assigns(:person)
0
     def assigns(key = nil)
0
       if key.nil?
0
         @response.template.assigns
0
0
0
0
@@ -419,19 +429,23 @@
0
         @response.template.assigns[key.to_s]
0
       end
0
     end
0
-
0
+
0
+ # Shortcut for @response.session
0
     def session
0
       @response.session
0
     end
0
-
0
+
0
+ # Shortcut for @response.flash
0
     def flash
0
       @response.flash
0
     end
0
-
0
+
0
+ # Shortcut for @response.cookies
0
     def cookies
0
       @response.cookies
0
     end
0
-
0
+
0
+ # Shortcut for @response.redirect_url
0
     def redirect_to_url
0
       @response.redirect_url
0
     end

Comments

    No one has commented yet.