Skip to content
This repository
Browse code

Update/clean up AP documentation (rdoc)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2649 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 1c057b7237c98d948b08b80c0ac403cda3028dab 1 parent 59f1df1
Jamis Buck authored October 16, 2005
2  actionpack/CHANGELOG
... ...
@@ -1,5 +1,7 @@
1 1
 *SVN*
2 2
 
  3
+* Update/clean up documentation (rdoc)
  4
+
3 5
 * Upgrade to Prototype 1.4.0_rc0 [Sam Stephenson]
4 6
 
5 7
 * Added assert_vaild. Reports the proper AR error messages as fail message when the passed record is invalid [Tobias Luetke]
24  actionpack/README
@@ -40,14 +40,14 @@ A short rundown of the major features:
40 40
       
41 41
       def update
42 42
         @customer = find_customer
43  
-        @customer.attributes = @params["customer"]
  43
+        @customer.attributes = params[:customer]
44 44
         @customer.save ? 
45 45
           redirect_to(:action => "display") : 
46 46
           render(:action => "edit")
47 47
       end
48 48
       
49 49
       private
50  
-        def find_customer() Customer.find(@params["id"]) end
  50
+        def find_customer() Customer.find(params[:id]) end
51 51
     end
52 52
 
53 53
   {Learn more}[link:classes/ActionController/Base.html]
@@ -182,7 +182,7 @@ A short rundown of the major features:
182 182
     # controller
183 183
     def list
184 184
       @pages, @people =
185  
-        paginate :people, :order_by => 'last_name, first_name'
  185
+        paginate :people, :order => 'last_name, first_name'
186 186
     end
187 187
 
188 188
     # view
@@ -202,8 +202,8 @@ A short rundown of the major features:
202 202
       end
203 203
 
204 204
       def test_failing_authenticate
205  
-        process :authenticate, "user_name" => "nop", "password" => ""
206  
-        assert_flash_has 'alert'
  205
+        process :authenticate, :user_name => "nop", :password => ""
  206
+        assert flash.has_key?(:alert)
207 207
         assert_redirected_to :action => "index"
208 208
       end
209 209
     end
@@ -252,10 +252,10 @@ A short rundown of the major features:
252 252
       end
253 253
       
254 254
       def update
255  
-        List.update(@params["list"]["id"], @params["list"])
256  
-        expire_page   :action => "show", :id => @params["list"]["id"]
  255
+        List.update(params[:list][:id], params[:list])
  256
+        expire_page   :action => "show", :id => params[:list][:id]
257 257
         expire_action :action => "account"
258  
-        redirect_to   :action => "show", :id => @params["list"]["id"]
  258
+        redirect_to   :action => "show", :id => params[:list][:id]
259 259
       end
260 260
     end
261 261
 
@@ -342,8 +342,8 @@ A short rundown of the major features:
342 342
     
343 343
     class WeblogController < ActionController::Base
344 344
       def save
345  
-        post = Post.create(@params["post"])
346  
-        redirect_to :action => "display", :path_params => { "id" => post.id }
  345
+        post = Post.create(params[:post])
  346
+        redirect_to :action => "display", :id => post.id
347 347
       end
348 348
     end
349 349
 
@@ -370,7 +370,7 @@ methods:
370 370
     end
371 371
     
372 372
     def display
373  
-      @post = Post.find(@params["id"])
  373
+      @post = Post.find(:params[:id])
374 374
     end
375 375
     
376 376
     def new
@@ -378,7 +378,7 @@ methods:
378 378
     end
379 379
     
380 380
     def create
381  
-      @post = Post.create(@params["post"])
  381
+      @post = Post.create(params[:post])
382 382
       redirect_to :action => "display", :id => @post.id
383 383
     end
384 384
   end
4  actionpack/lib/action_controller/base.rb
@@ -46,7 +46,7 @@ def initialize(message=nil)
46 46
   #     end
47 47
   #     
48 48
   #     def sign
49  
-  #       Entry.create(@params["entry"])
  49
+  #       Entry.create(params[:entry])
50 50
   #       redirect_to :action => "index"
51 51
   #     end
52 52
   #   end
@@ -83,7 +83,7 @@ def initialize(message=nil)
83 83
   #
84 84
   #   def hello_ip
85 85
   #     location = request.env["REMOTE_IP"]
86  
-  #     render_text "Hello stranger from #{location}"
  86
+  #     render :text => "Hello stranger from #{location}"
87 87
   #   end
88 88
   #
89 89
   # == Parameters
2  actionpack/lib/action_controller/caching.rb
@@ -350,7 +350,7 @@ def delete_matched(matcher, options=nil) #:nodoc:
350 350
         end
351 351
       end
352 352
 
353  
-      module ThreadSafety
  353
+      module ThreadSafety #:nodoc:
354 354
         def read(name, options=nil) #:nodoc:
355 355
           @mutex.synchronize { super }
356 356
         end
14  actionpack/lib/action_controller/flash.rb
... ...
@@ -1,14 +1,14 @@
1 1
 module ActionController #:nodoc:
2 2
   # The flash provides a way to pass temporary objects between actions. Anything you place in the flash will be exposed
3 3
   # to the very next action and then cleared out. This is a great way of doing notices and alerts, such as a create action
4  
-  # that sets <tt>flash["notice"] = "Successfully created"</tt> before redirecting to a display action that can then expose 
  4
+  # that sets <tt>flash[:notice] = "Successfully created"</tt> before redirecting to a display action that can then expose 
5 5
   # the flash to its template. Actually, that exposure is automatically done. Example:
6 6
   #
7 7
   #   class WeblogController < ActionController::Base
8 8
   #     def create
9 9
   #       # save post
10  
-  #       flash["notice"] = "Successfully created post"
11  
-  #       redirect_to :action => "display", :params => { "id" => post.id }
  10
+  #       flash[:notice] = "Successfully created post"
  11
+  #       redirect_to :action => "display", :params => { :id => post.id }
12 12
   #     end
13 13
   #
14 14
   #     def display
@@ -17,7 +17,7 @@ module ActionController #:nodoc:
17 17
   #   end
18 18
   #
19 19
   #   display.rhtml
20  
-  #     <% if @flash["notice"] %><div class="notice"><%= @flash["notice"] %></div><% end %>
  20
+  #     <% if @flash[:notice] %><div class="notice"><%= @flash[:notice] %></div><% end %>
21 21
   #
22 22
   # This example just places a string in the flash, but you can put any object in there. And of course, you can put as many
23 23
   # as you like at a time too. Just remember: They'll be gone by the time the next action has been performed.
@@ -67,7 +67,7 @@ def replace h #:nodoc:
67 67
     
68 68
       # Sets a flash that will not be available to the next action, only to the current.
69 69
       #
70  
-      #     flash.now["message"] = "Hello current action"
  70
+      #     flash.now[:message] = "Hello current action"
71 71
       # 
72 72
       # This method enables you to use the flash as a central messaging system in your app.
73 73
       # When you need to pass an object to the next action, you use the standard flash assign (<tt>[]=</tt>).
@@ -82,7 +82,7 @@ def now
82 82
       # Keeps either the entire current flash or a specific flash entry available for the next action:
83 83
       #
84 84
       #    flash.keep            # keeps the entire flash
85  
-      #    flash.keep("notice")  # keeps only the "notice" entry, the rest of the flash is discarded
  85
+      #    flash.keep(:notice)   # keeps only the "notice" entry, the rest of the flash is discarded
86 86
       def keep(k=nil)
87 87
         use(k, false)
88 88
       end
@@ -90,7 +90,7 @@ def keep(k=nil)
90 90
       # Marks the entire flash or a single flash entry to be discarded by the end of the current action
91 91
       #
92 92
       #     flash.keep                 # keep entire flash available for the next action
93  
-      #     flash.discard('warning')   # discard the "warning" entry (it'll still be available for the current action)
  93
+      #     flash.discard(:warning)    # discard the "warning" entry (it'll still be available for the current action)
94 94
       def discard(k=nil)
95 95
         use(k)
96 96
       end
2  actionpack/lib/action_controller/pagination.rb
@@ -167,7 +167,7 @@ def count_collection_for_pagination(model, conditions, joins)
167 167
     end
168 168
   
169 169
     # Returns a collection of items for the given +model+ and +options[conditions]+,
170  
-    # ordered by +options[order_by]+, for the current page in the given +paginator+.
  170
+    # ordered by +options[order]+, for the current page in the given +paginator+.
171 171
     # Override this method to implement a custom finder.
172 172
     def find_collection_for_pagination(model, options, paginator)
173 173
       model.find(:all, :conditions => options[:conditions],
16  actionpack/lib/action_controller/request.rb
@@ -130,6 +130,8 @@ def raw_post
130 130
       env['RAW_POST_DATA']
131 131
     end
132 132
     
  133
+    # Returns the request URI correctly, taking into account the idiosyncracies
  134
+    # of the various servers.
133 135
     def request_uri
134 136
       if uri = env['REQUEST_URI']
135 137
         (%r{^\w+\://[^/]+(/.*|$)$} =~ uri) ? $1 : uri # Remove domain, which webrick puts into the request_uri.
@@ -216,25 +218,25 @@ def server_software
216 218
     #--
217 219
     # Must be implemented in the concrete request
218 220
     #++
219  
-    def query_parameters
  221
+    def query_parameters #:nodoc:
220 222
     end
221 223
 
222  
-    def request_parameters
  224
+    def request_parameters #:nodoc:
223 225
     end
224 226
 
225  
-    def env
  227
+    def env #:nodoc:
226 228
     end
227 229
 
228  
-    def host
  230
+    def host #:nodoc:
229 231
     end
230 232
 
231  
-    def cookies
  233
+    def cookies #:nodoc:
232 234
     end
233 235
 
234  
-    def session
  236
+    def session #:nodoc:
235 237
     end
236 238
 
237  
-    def reset_session
  239
+    def reset_session #:nodoc:
238 240
     end    
239 241
   end
240 242
 end
2  actionpack/lib/action_controller/session_management.rb
@@ -77,7 +77,7 @@ def session(*args)
77 77
         write_inheritable_array("session_options", [options])
78 78
       end
79 79
 
80  
-      def cached_session_options
  80
+      def cached_session_options #:nodoc:
81 81
         @session_options ||= read_inheritable_attribute("session_options") || []
82 82
       end
83 83
 
2  actionpack/lib/action_pack/version.rb
... ...
@@ -1,5 +1,5 @@
1 1
 module ActionPack
2  
-  module Version
  2
+  module Version #:nodoc:
3 3
     MAJOR = 1
4 4
     MINOR = 9
5 5
     TINY  = 1
9  actionpack/lib/action_view/base.rb
@@ -135,7 +135,7 @@ class Base
135 135
 
136 136
     @@template_handlers = {}
137 137
  
138  
-    module CompiledTemplates
  138
+    module CompiledTemplates #:nodoc:
139 139
       # holds compiled template code
140 140
     end
141 141
     include CompiledTemplates
@@ -162,6 +162,13 @@ def self.load_helpers(helper_dir)#:nodoc:
162 162
       end
163 163
     end
164 164
 
  165
+    # Register a class that knows how to handle template files with the given
  166
+    # extension. This can be used to implement new template types.
  167
+    # The constructor for the class must take the ActiveView::Base instance
  168
+    # as a parameter, and the class must implement a #render method that
  169
+    # takes the contents of the template to render as well as the Hash of
  170
+    # local assigns available to the template. The #render method ought to
  171
+    # return the rendered template as a string.
165 172
     def self.register_template_handler(extension, klass)
166 173
       @@template_handlers[extension] = klass
167 174
     end
2  actionpack/lib/action_view/helpers/text_helper.rb
@@ -252,7 +252,7 @@ def reset_cycle(name = "default")
252 252
         cycle.reset
253 253
       end
254 254
 
255  
-      class Cycle
  255
+      class Cycle #:nodoc:
256 256
         attr_reader :values
257 257
         
258 258
         def initialize(first_value, *values)

0 notes on commit 1c057b7

Please sign in to comment.
Something went wrong with that request. Please try again.