Take the 2008 Git User's Survey and help out! [ hide ]

public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
Search Repo:
Merge with docrails.
lifo (author)
Wed Jul 16 05:00:36 -0700 2008
commit  0432d151647f2178ddee79979827d552447c251f
tree    7c772cd260eb051cd7b80cf91468555f03db9e11
parent  f7d08acd5e0650658383e3d3f86d6ff5b49e9030
...
38
39
40
41
 
42
43
44
...
143
144
145
146
 
147
148
149
...
38
39
40
 
41
42
43
44
...
143
144
145
 
146
147
148
149
0
@@ -38,7 +38,7 @@ module TMail
0
   # = Class Address
0
   #
0
   # Provides a complete handling library for email addresses. Can parse a string of an
0
- # address directly or take in preformatted addresses themseleves. Allows you to add
0
+ # address directly or take in preformatted addresses themselves. Allows you to add
0
   # and remove phrases from the front of the address and provides a compare function for
0
   # email addresses.
0
   #
0
@@ -143,7 +143,7 @@ module TMail
0
       
0
       # This is to catch an unquoted "@" symbol in the local part of the
0
       # address. Handles addresses like <"@"@me.com> and makes sure they
0
- # stay like <"@"@me.com> (previously were becomming <@@me.com>)
0
+ # stay like <"@"@me.com> (previously were becoming <@@me.com>)
0
       if local && (local.join == '@' || local.join =~ /\A[^"].*?@.*?[^"]\Z/)
0
         @local = "\"#{local.join}\""
0
       else
...
59
60
61
62
 
63
64
65
...
59
60
61
 
62
63
64
65
0
@@ -59,7 +59,7 @@ module TMail
0
       #
0
       # This is because a mailbox doesn't have the : after the From that designates the
0
       # beginning of the envelope sender (which can be different to the from address of
0
- # the emial)
0
+ # the email)
0
       #
0
       # Other fields can be passed as normal, "Reply-To", "Received" etc.
0
       #
...
42
43
44
45
 
46
47
48
...
42
43
44
 
45
46
47
48
0
@@ -42,7 +42,7 @@ module TMail
0
     # Allows you to query the mail object with a string to get the contents
0
     # of the field you want.
0
     #
0
- # Returns a string of the exact contnts of the field
0
+ # Returns a string of the exact contents of the field
0
     #
0
     # mail.from = "mikel <mikel@lindsaar.net>"
0
     # mail.header_string("From") #=> "mikel <mikel@lindsaar.net>"
...
255
256
257
258
 
259
260
261
...
265
266
267
268
 
269
270
271
...
255
256
257
 
258
259
260
261
...
265
266
267
 
268
269
270
271
0
@@ -255,7 +255,7 @@ module TMail
0
     alias fetch []
0
 
0
     # Allows you to set or delete TMail header objects at will.
0
- # Eamples:
0
+ # Examples:
0
     # @mail = TMail::Mail.new
0
     # @mail['to'].to_s # => 'mikel@test.com.au'
0
     # @mail['to'] = 'mikel@elsewhere.org'
0
@@ -265,7 +265,7 @@ module TMail
0
     # @mail['to'].to_s # => nil
0
     # @mail.encoded # => "\r\n"
0
     #
0
- # Note: setting mail[] = nil actualy deletes the header field in question from the object,
0
+ # Note: setting mail[] = nil actually deletes the header field in question from the object,
0
     # it does not just set the value of the hash to nil
0
     def []=( key, val )
0
       dkey = key.downcase
...
31
32
33
34
 
35
36
37
...
168
169
170
171
 
172
173
174
...
177
178
179
180
 
181
182
183
...
192
193
194
195
196
197
198
199
200
201
202
 
203
 
204
205
206
...
208
209
210
211
 
212
213
214
...
31
32
33
 
34
35
36
37
...
168
169
170
 
171
172
173
174
...
177
178
179
 
180
181
182
183
...
192
193
194
 
 
 
 
 
 
 
 
195
196
197
198
199
200
...
202
203
204
 
205
206
207
208
0
@@ -31,7 +31,7 @@ http://www.rubyonrails.org.
0
 A short rundown of the major features:
0
 
0
 * Actions grouped in controller as methods instead of separate command objects
0
- and can therefore share helper methods.
0
+ and can therefore share helper methods
0
 
0
     BlogController < ActionController::Base
0
       def show
0
@@ -168,7 +168,7 @@ A short rundown of the major features:
0
   {Learn more}[link:classes/ActionController/Base.html]
0
 
0
 
0
-* Javascript and Ajax integration.
0
+* Javascript and Ajax integration
0
 
0
     link_to_function "Greeting", "alert('Hello world!')"
0
     link_to_remote "Delete this post", :update => "posts",
0
@@ -177,7 +177,7 @@ A short rundown of the major features:
0
   {Learn more}[link:classes/ActionView/Helpers/JavaScriptHelper.html]
0
 
0
 
0
-* Pagination for navigating lists of results.
0
+* Pagination for navigating lists of results
0
 
0
     # controller
0
     def list
0
@@ -192,15 +192,9 @@ A short rundown of the major features:
0
   {Learn more}[link:classes/ActionController/Pagination.html]
0
 
0
 
0
-* Easy testing of both controller and template result through TestRequest/Response
0
-
0
- class LoginControllerTest < Test::Unit::TestCase
0
- def setup
0
- @controller = LoginController.new
0
- @request = ActionController::TestRequest.new
0
- @response = ActionController::TestResponse.new
0
- end
0
+* Easy testing of both controller and rendered template through ActionController::TestCase
0
 
0
+ class LoginControllerTest < ActionController::TestCase
0
       def test_failing_authenticate
0
         process :authenticate, :user_name => "nop", :password => ""
0
         assert flash.has_key?(:alert)
0
@@ -208,7 +202,7 @@ A short rundown of the major features:
0
       end
0
     end
0
 
0
- {Learn more}[link:classes/ActionController/TestRequest.html]
0
+ {Learn more}[link:classes/ActionController/TestCase.html]
0
 
0
 
0
 * Automated benchmarking and integrated logging
...
21
22
23
24
25
26
27
 
 
28
29
30
...
21
22
23
 
 
 
 
24
25
26
27
28
0
@@ -21,10 +21,8 @@ module ActionController
0
     # from the response HTML or elements selected by the enclosing assertion.
0
     #
0
     # In addition to HTML responses, you can make the following assertions:
0
- # * +assert_select_rjs+ - Assertions on HTML content of RJS update and
0
- # insertion operations.
0
- # * +assert_select_encoded+ - Assertions on HTML encoded inside XML,
0
- # for example for dealing with feed item descriptions.
0
+ # * +assert_select_rjs+ - Assertions on HTML content of RJS update and insertion operations.
0
+ # * +assert_select_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
0
     # * +assert_select_email+ - Assertions on the HTML body of an e-mail.
0
     #
0
     # Also see HTML::Selector to learn how to use selectors.
...
2
3
4
5
 
6
7
8
...
2
3
4
 
5
6
7
8
0
@@ -2,7 +2,7 @@ module ActionController #:nodoc:
0
   module Caching
0
     # Fragment caching is used for caching various blocks within templates without caching the entire action as a whole. This is useful when
0
     # certain elements of an action change frequently or depend on complicated state while other parts rarely change or can be shared amongst multiple
0
- # parties. The caching is doing using the cache helper available in the Action View. A template with caching might look something like:
0
+ # parties. The caching is done using the cache helper available in the Action View. A template with caching might look something like:
0
     #
0
     # <b>Hello <%= @name %></b>
0
     # <% cache do %>
...
22
23
24
 
 
 
 
 
 
 
 
 
 
25
26
27
...
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
0
@@ -22,6 +22,16 @@ module ActionController #:nodoc:
0
   #
0
   # cookies.delete :user_name
0
   #
0
+ # Please note that if you specify a :domain when setting a cookie, you must also specify the domain when deleting the cookie:
0
+ #
0
+ # cookies[:key] = {
0
+ # :value => 'a yummy cookie',
0
+ # :expires => 1.year.from_now,
0
+ # :domain => 'domain.com'
0
+ # }
0
+ #
0
+ # cookies.delete(:key, :domain => 'domain.com')
0
+ #
0
   # The option symbols for setting cookies are:
0
   #
0
   # * <tt>:value</tt> - The cookie's value or list of values (as an array).
...
101
102
103
104
 
105
106
107
...
101
102
103
 
104
105
106
107
0
@@ -101,7 +101,7 @@ module ActionController
0
         @https = flag
0
       end
0
 
0
- # Return +true+ if the session is mimicing a secure HTTPS request.
0
+ # Return +true+ if the session is mimicking a secure HTTPS request.
0
       #
0
       # if session.https?
0
       # ...
...
250
251
252
253
 
254
255
256
...
250
251
252
 
253
254
255
256
0
@@ -250,7 +250,7 @@ end_msg
0
 
0
           # Convert 'cookie' header to 'Set-Cookie' headers.
0
           # Because Set-Cookie header can appear more the once in the response body,
0
- # we store it in a line break seperated string that will be translated to
0
+ # we store it in a line break separated string that will be translated to
0
           # multiple Set-Cookie header by the handler.
0
           if cookie = options.delete('cookie')
0
             cookies = []
...
61
62
63
64
 
65
66
67
...
265
266
267
268
 
269
270
271
...
274
275
276
277
 
278
279
280
...
61
62
63
 
64
65
66
67
...
265
266
267
 
268
269
270
271
...
274
275
276
 
277
278
279
280
0
@@ -61,7 +61,7 @@ module ActionController
0
       request_method == :head
0
     end
0
 
0
- # Provides acccess to the request's HTTP headers, for example:
0
+ # Provides access to the request's HTTP headers, for example:
0
     # request.headers["Content-Type"] # => "text/plain"
0
     def headers
0
       @headers ||= ActionController::Http::Headers.new(@env)
0
@@ -265,7 +265,7 @@ EOM
0
       parts[0..-(tld_length+2)]
0
     end
0
 
0
- # Return the query string, accounting for server idiosyncracies.
0
+ # Return the query string, accounting for server idiosyncrasies.
0
     def query_string
0
       if uri = @env['REQUEST_URI']
0
         uri.split('?', 2)[1] || ''
0
@@ -274,7 +274,7 @@ EOM
0
       end
0
     end
0
 
0
- # Return the request URI, accounting for server idiosyncracies.
0
+ # Return the request URI, accounting for server idiosyncrasies.
0
     # WEBrick includes the full URL. IIS leaves REQUEST_URI blank.
0
     def request_uri
0
       if uri = @env['REQUEST_URI']
...
17
18
19
20
 
21
22
23
...
17
18
19
 
20
21
22
23
0
@@ -17,7 +17,7 @@ module ActionController #:nodoc:
0
     # forged link from another site, is done by embedding a token based on the session (which an attacker wouldn't know) in all
0
     # forms and Ajax requests generated by Rails and then verifying the authenticity of that token in the controller. Only
0
     # HTML/JavaScript requests are checked, so this will not protect your XML API (presumably you'll have a different authentication
0
- # scheme there anyway). Also, GET requests are not protected as these should be indempotent anyway.
0
+ # scheme there anyway). Also, GET requests are not protected as these should be idempotent anyway.
0
     #
0
     # This is turned on with the <tt>protect_from_forgery</tt> method, which will check the token and raise an
0
     # ActionController::InvalidAuthenticityToken if it doesn't match what was expected. You can customize the error message in
...
296
297
298
 
 
 
 
299
300
301
...
296
297
298
299
300
301
302
303
304
305
0
@@ -296,6 +296,10 @@ module ActionController
0
     # article_comments_url(:article_id => @article)
0
     # article_comment_url(:article_id => @article, :id => @comment)
0
     #
0
+ # If you don't want to load all objects from the database you might want to use the <tt>article_id</tt> directly:
0
+ #
0
+ # articles_comments_url(@comment.article_id, @comment)
0
+ #
0
     # * <tt>:name_prefix</tt> - Define a prefix for all generated routes, usually ending in an underscore.
0
     # Use this if you have named routes that may clash.
0
     #
...
12
13
14
15
16
17
 
 
 
 
18
19
 
20
21
22
23
24
25
26
27
 
 
 
28
29
30
...
35
36
37
 
 
 
 
 
 
38
39
40
...
99
100
101
102
103
 
104
105
106
...
12
13
14
 
 
 
15
16
17
18
19
 
20
21
22
23
24
25
26
 
 
27
28
29
30
31
32
...
37
38
39
40
41
42
43
44
45
46
47
48
...
107
108
109
 
 
110
111
112
113
0
@@ -12,19 +12,21 @@ module ActionController #:nodoc:
0
     X_SENDFILE_HEADER = 'X-Sendfile'.freeze
0
 
0
     protected
0
- # Sends the file by streaming it 4096 bytes at a time. This way the
0
- # whole file doesn't need to be read into memory at once. This makes
0
- # it feasible to send even large files.
0
+ # Sends the file, by default streaming it 4096 bytes at a time. This way the
0
+ # whole file doesn't need to be read into memory at once. This makes it
0
+ # feasible to send even large files. You can optionally turn off streaming
0
+ # and send the whole file at once.
0
       #
0
- # Be careful to sanitize the path parameter if it coming from a web
0
+ # Be careful to sanitize the path parameter if it is coming from a web
0
       # page. <tt>send_file(params[:path])</tt> allows a malicious user to
0
       # download any file on your server.
0
       #
0
       # Options:
0
       # * <tt>:filename</tt> - suggests a filename for the browser to use.
0
       # Defaults to <tt>File.basename(path)</tt>.
0
- # * <tt>:type</tt> - specifies an HTTP content type.
0
- # Defaults to 'application/octet-stream'.
0
+ # * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'.
0
+ # * <tt>:length</tt> - used to manually override the length (in bytes) of the content that
0
+ # is going to be sent to the client. Defaults to <tt>File.size(path)</tt>.
0
       # * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
0
       # Valid values are 'inline' and 'attachment' (default).
0
       # * <tt>:stream</tt> - whether to send the file to the user agent as it is read (+true+)
0
@@ -35,6 +37,12 @@ module ActionController #:nodoc:
0
       # * <tt>:url_based_filename</tt> - set to +true+ if you want the browser guess the filename from
0
       # the URL, which is necessary for i18n filenames on certain browsers
0
       # (setting <tt>:filename</tt> overrides this option).
0
+ # * <tt>:x_sendfile</tt> - uses X-Sendfile to send the file when set to +true+. This is currently
0
+ # only available with Lighttpd/Apache2 and specific modules installed and activated. Since this
0
+ # uses the web server to send the file, this may lower memory consumption on your server and
0
+ # it will not block your application for further requests.
0
+ # See http://blog.lighttpd.net/articles/2006/07/02/x-sendfile and
0
+ # http://tn123.ath.cx/mod_xsendfile/ for details. Defaults to +false+.
0
       #
0
       # The default Content-Type and Content-Disposition headers are
0
       # set to download arbitrary binary files in as many browsers as
0
@@ -99,8 +107,7 @@ module ActionController #:nodoc:
0
       #
0
       # Options:
0
       # * <tt>:filename</tt> - suggests a filename for the browser to use.
0
- # * <tt>:type</tt> - specifies an HTTP content type.
0
- # Defaults to 'application/octet-stream'.
0
+ # * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'.
0
       # * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
0
       # Valid values are 'inline' and 'attachment' (default).
0
       # * <tt>:status</tt> - specifies the status code to send with the response. Defaults to '200 OK'.
...
15
16
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
19
20
...
41
42
43
 
 
44
45
46
...
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
40
41
...
62
63
64
65
66
67
68
69
0
@@ -15,6 +15,27 @@ module ActionController
0
     end
0
   end
0
 
0
+ # Superclass for Action Controller functional tests. Infers the controller under test from the test class name,
0
+ # and creates @controller, @request, @response instance variables.
0
+ #
0
+ # class WidgetsControllerTest < ActionController::TestCase
0
+ # def test_index
0
+ # get :index
0
+ # end
0
+ # end
0
+ #
0
+ # * @controller - WidgetController.new
0
+ # * @request - ActionController::TestRequest.new
0
+ # * @response - ActionController::TestResponse.new
0
+ #
0
+ # (Earlier versions of Rails required each functional test to subclass Test::Unit::TestCase and define
0
+ # @controller, @request, @response in +setup+.)
0
+ #
0
+ # If the controller cannot be inferred from the test class name, you can explicity set it with +tests+.
0
+ #
0
+ # class SpecialEdgeCaseWidgetsControllerTest < ActionController::TestCase
0
+ # tests WidgetController
0
+ # end
0
   class TestCase < ActiveSupport::TestCase
0
     # When the request.remote_addr remains the default for testing, which is 0.0.0.0, the exception is simply raised inline
0
     # (bystepping the regular exception handling from rescue_action). If the request.remote_addr is anything else, the regular
0
@@ -41,6 +62,8 @@ module ActionController
0
     @@controller_class = nil
0
 
0
     class << self
0
+ # Sets the controller class name. Useful if the name can't be inferred from test class.
0
+ # Expects +controller_class+ as a constant. Example: <tt>tests WidgetController</tt>.
0
       def tests(controller_class)
0
         self.controller_class = controller_class
0
       end
...
211
212
213
214
 
215
216
217
...
211
212
213
 
214
215
216
217
0
@@ -211,7 +211,7 @@ module ActionController #:nodoc:
0
       template._first_render
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
...
64
65
66
67
 
68
69
70
...
158
159
160
161
 
162
163
164
...
64
65
66
 
67
68
69
70
...
158
159
160
 
161
162
163
164
0
@@ -64,7 +64,7 @@ module HTML
0
   #
0
   # When using a combination of the above, the element name comes first
0
   # followed by identifier, class names, attributes, pseudo classes and
0
- # negation in any order. Do not seprate these parts with spaces!
0
+ # negation in any order. Do not separate these parts with spaces!
0
   # Space separation is used for descendant selectors.
0
   #
0
   # For example:
0
@@ -158,7 +158,7 @@ module HTML
0
   # * <tt>:not(selector)</tt> -- Match the element only if the element does not
0
   # match the simple selector.
0
   #
0
- # As you can see, <tt>:nth-child<tt> pseudo class and its varient can get quite
0
+ # As you can see, <tt>:nth-child<tt> pseudo class and its variant can get quite
0
   # tricky and the CSS specification doesn't do a much better job explaining it.
0
   # But after reading the examples and trying a few combinations, it's easy to
0
   # figure out.
...
177
178
179
180
 
181
182
183
...
177
178
179
 
180
181
182
183
0
@@ -177,7 +177,7 @@ module ActionView #:nodoc:
0
     end
0
 
0
     def self.cache_template_extensions=(*args)
0
- ActiveSupport::Deprecation.warn("config.action_view.cache_template_extensions option has been deprecated and has no affect. " <<
0
+ ActiveSupport::Deprecation.warn("config.action_view.cache_template_extensions option has been deprecated and has no effect. " <<
0
                                        "Please remove it from your config files.", caller)
0
     end
0
 
...
141
142
143
144
 
145
146
147
...
141
142
143
 
144
145
146
147
0
@@ -141,7 +141,7 @@ module ActionView
0
       #
0
       # error_messages_for 'user_common', 'user', :object_name => 'user'
0
       #
0
- # If the objects cannot be located as instance variables, you can add an extra <tt>:object</tt> paremeter which gives the actual
0
+ # If the objects cannot be located as instance variables, you can add an extra <tt>:object</tt> parameter which gives the actual
0
       # object (or array of objects to use):
0
       #
0
       # error_messages_for 'user', :object => @question.user
...
280
281
282
283
 
284
285
286
287
 
288
289
290
...
280
281
282
 
283
284
285
286
 
287
288
289
290
0
@@ -280,11 +280,11 @@ module ActionView
0
       #
0
       # # Generates a date select that discards the type of the field and defaults to the date in
0
       # # my_date (six days after today)
0
- # select_datetime(my_date_time, :discard_type => true)
0
+ # select_date(my_date, :discard_type => true)
0
       #
0
       # # Generates a date select that defaults to the datetime in my_date (six days after today)
0
       # # prefixed with 'payday' rather than 'date'
0
- # select_datetime(my_date_time, :prefix => 'payday')
0
+ # select_date(my_date, :prefix => 'payday')
0
       #
0
       def select_date(date = Date.current, options = {}, html_options = {})
0
         options[:order] ||= []
...
2
3
4
5
6
 
 
 
7
8
9
10
11
12
13
14
15
16
17
18
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
21
22
...
28
29
30
31
32
 
...
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
...
35
36
37
 
38
39
0
@@ -2,21 +2,28 @@ module ActionView
0
   module Helpers
0
     # Provides a set of methods for making it easier to debug Rails objects.
0
     module DebugHelper
0
- # Returns a <pre>-tag that has +object+ dumped by YAML. This creates a very
0
- # readable way to inspect an object.
0
+ # Returns a YAML representation of +object+ wrapped with <pre> and </pre>.
0
+ # If the object cannot be converted to YAML using +to_yaml+, +inspect+ will be called instead.
0
+ # Useful for inspecting an object at the time of rendering.
0
       #
0
       # ==== Example
0
- # my_hash = {'first' => 1, 'second' => 'two', 'third' => [1,2,3]}
0
- # debug(my_hash)
0
       #
0
- # => <pre class='debug_dump'>---
0
- # first: 1
0
- # second: two
0
- # third:
0
- # - 1
0
- # - 2
0
- # - 3
0
- # </pre>
0
+ # @user = User.new({ :username => 'testing', :password => 'xyz', :age => 42}) %>
0
+ # debug(@user)
0
+ # # =>
0
+ # <pre class='debug_dump'>--- !ruby/object:User
0
+ # attributes:
0
+ # &nbsp; updated_at:
0
+ # &nbsp; username: testing
0
+ #
0
+ # &nbsp; age: 42
0
+ # &nbsp; password: xyz
0
+ # &nbsp; created_at:
0
+ # attributes_cache: {}
0
+ #
0
+ # new_record: true
0
+ # </pre>
0
+
0
       def debug(object)
0
         begin
0
           Marshal::dump(object)
0
@@ -28,4 +35,4 @@ module ActionView
0
       end
0
     end
0
   end
0
-end
0
\ No newline at end of file
0
+end
...
76
77
78
79
 
80
81
82
...
449
450
451
452
453
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
455
456
...
76
77
78
 
79
80
81
82<