Permalink
Browse files

Outdented protected code sections per contribution guide.

  • Loading branch information...
1 parent 906abbf commit e875ad02195203760bc14c16835c08c2948a4376 @parndt committed Mar 13, 2012
Showing with 2,999 additions and 2,999 deletions.
  1. +11 −11 actionmailer/lib/action_mailer/test_case.rb
  2. +22 −22 actionmailer/test/base_test.rb
  3. +1 −1 actionmailer/test/mail_helper_test.rb
  4. +9 −9 actionpack/lib/action_controller/caching/sweeping.rb
  5. +94 −94 actionpack/lib/action_controller/metal/data_streaming.rb
  6. +13 −13 actionpack/lib/action_controller/metal/flash.rb
  7. +34 −34 actionpack/lib/action_controller/metal/http_authentication.rb
  8. +1 −1 actionpack/lib/action_controller/metal/params_wrapper.rb
  9. +42 −42 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  10. +1 −1 actionpack/lib/action_controller/metal/streaming.rb
  11. +8 −8 actionpack/lib/action_controller/test_case.rb
  12. +1 −1 actionpack/lib/action_dispatch/http/mime_negotiation.rb
  13. +1 −1 actionpack/lib/action_dispatch/middleware/flash.rb
  14. +972 −972 actionpack/lib/action_dispatch/routing/mapper.rb
  15. +1 −1 actionpack/lib/action_dispatch/routing/url_for.rb
  16. +5 −5 actionpack/lib/action_dispatch/testing/assertions/selector.rb
  17. +1 −1 actionpack/lib/action_view/renderer/abstract_renderer.rb
  18. +85 −85 actionpack/lib/action_view/template.rb
  19. +1 −1 actionpack/lib/action_view/template/handlers/builder.rb
  20. +1 −1 actionpack/test/abstract_unit.rb
  21. +9 −9 actionpack/test/controller/assert_select_test.rb
  22. +18 −18 actionpack/test/controller/filters_test.rb
  23. +7 −7 actionpack/test/controller/mime_responds_test.rb
  24. +3 −3 actionpack/test/controller/new_base/base_test.rb
  25. +1 −1 actionpack/test/controller/new_base/render_context_test.rb
  26. +4 −4 actionpack/test/controller/redirect_test.rb
  27. +11 −11 actionpack/test/controller/rescue_test.rb
  28. +221 −221 actionpack/test/controller/resources_test.rb
  29. +7 −7 actionpack/test/template/date_helper_test.rb
  30. +1 −1 actionpack/test/template/form_helper_test.rb
  31. +7 −7 actionpack/test/template/output_buffer_test.rb
  32. +6 −6 actionpack/test/template/url_helper_test.rb
  33. +8 −8 activemodel/lib/active_model/attribute_methods.rb
  34. +1 −1 activemodel/lib/active_model/mass_assignment_security.rb
  35. +58 −58 activemodel/lib/active_model/observer_array.rb
  36. +28 −28 activemodel/lib/active_model/observing.rb
  37. +1 −1 activerecord/lib/active_record/associations/join_dependency.rb
  38. +14 −14 activerecord/lib/active_record/associations/through_association.rb
  39. +1 −1 activerecord/lib/active_record/attribute_assignment.rb
  40. +1 −1 activerecord/lib/active_record/attribute_methods.rb
  41. +1 −1 activerecord/lib/active_record/attribute_methods/primary_key.rb
  42. +1 −1 activerecord/lib/active_record/attribute_methods/read.rb
  43. +1 −1 activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
  44. +8 −8 activerecord/lib/active_record/attribute_methods/write.rb
  45. +46 −46 activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb
  46. +52 −52 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  47. +21 −21 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  48. +1 −1 activerecord/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
  49. +33 −33 activerecord/lib/active_record/connection_adapters/column.rb
  50. +15 −15 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  51. +91 −91 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  52. +1 −1 activerecord/lib/active_record/inheritance.rb
  53. +20 −20 activerecord/lib/active_record/observer.rb
  54. +1 −1 activerecord/lib/active_record/relation/delegation.rb
  55. +1 −1 activerecord/lib/active_record/relation/finder_methods.rb
  56. +1 −1 activerecord/lib/active_record/sanitization.rb
  57. +1 −1 activerecord/lib/active_record/scoping.rb
  58. +1 −1 activerecord/lib/active_record/scoping/default.rb
  59. +1 −1 activerecord/lib/active_record/transactions.rb
  60. +7 −7 activerecord/lib/rails/generators/active_record/migration/migration_generator.rb
  61. +4 −4 activerecord/lib/rails/generators/active_record/model/model_generator.rb
  62. +7 −7 activerecord/lib/rails/generators/active_record/session_migration/session_migration_generator.rb
  63. +19 −19 activerecord/test/cases/finder_test.rb
  64. +24 −24 activerecord/test/cases/locking_test.rb
  65. +9 −9 activerecord/test/cases/migration_test.rb
  66. +1 −1 activerecord/test/models/company.rb
  67. +1 −1 activerecord/test/models/company_in_module.rb
  68. +5 −5 activerecord/test/models/subject.rb
  69. +16 −16 activerecord/test/models/topic.rb
  70. +39 −39 activeresource/lib/active_resource/base.rb
  71. +15 −15 activeresource/test/cases/connection_test.rb
  72. +1 −1 activeresource/test/cases/validations_test.rb
  73. +27 −27 activesupport/lib/active_support/cache.rb
  74. +26 −26 activesupport/lib/active_support/cache/file_store.rb
  75. +32 −32 activesupport/lib/active_support/cache/mem_cache_store.rb
  76. +27 −27 activesupport/lib/active_support/cache/memory_store.rb
  77. +9 −9 activesupport/lib/active_support/cache/null_store.rb
  78. +19 −19 activesupport/lib/active_support/cache/strategy/local_cache.rb
  79. +14 −14 activesupport/lib/active_support/dependencies.rb
  80. +11 −11 activesupport/lib/active_support/duration.rb
  81. +12 −12 activesupport/lib/active_support/hash_with_indifferent_access.rb
  82. +15 −15 activesupport/lib/active_support/multibyte/chars.rb
  83. +7 −7 activesupport/lib/active_support/rescuable.rb
  84. +38 −38 activesupport/lib/active_support/testing/performance.rb
  85. +20 −20 activesupport/lib/active_support/testing/performance/jruby.rb
  86. +17 −17 activesupport/lib/active_support/testing/performance/rubinius.rb
  87. +29 −29 activesupport/lib/active_support/testing/performance/ruby.rb
  88. +7 −7 activesupport/lib/active_support/values/time_zone.rb
  89. +1 −1 activesupport/lib/active_support/xml_mini.rb
  90. +14 −14 activesupport/test/core_ext/date_ext_test.rb
  91. +7 −7 activesupport/test/core_ext/date_time_ext_test.rb
  92. +7 −7 activesupport/test/core_ext/duration_test.rb
  93. +7 −7 activesupport/test/core_ext/numeric_ext_test.rb
  94. +10 −10 activesupport/test/core_ext/time_ext_test.rb
  95. +14 −14 activesupport/test/core_ext/time_with_zone_test.rb
  96. +1 −1 activesupport/test/descendants_tracker_test_cases.rb
  97. +10 −10 activesupport/test/json/encoding_test.rb
  98. +23 −23 activesupport/test/multibyte_conformance.rb
  99. +4 −4 activesupport/test/notifications_test.rb
  100. +17 −17 activesupport/test/test_test.rb
  101. +7 −7 activesupport/test/time_zone_test.rb
  102. +63 −63 railties/lib/rails/generators.rb
  103. +20 −20 railties/lib/rails/generators/actions.rb
  104. +108 −108 railties/lib/rails/generators/base.rb
  105. +1 −1 railties/lib/rails/generators/erb.rb
  106. +1 −1 railties/lib/rails/generators/erb/mailer/mailer_generator.rb
  107. +126 −126 railties/lib/rails/generators/named_base.rb
  108. +1 −1 railties/lib/rails/generators/rails/assets/assets_generator.rb
  109. +7 −7 railties/lib/rails/generators/rails/generator/generator_generator.rb
  110. +35 −35 railties/lib/rails/generators/resource_helpers.rb
  111. +16 −16 railties/lib/rails/generators/test_case.rb
  112. +1 −1 railties/lib/rails/info_controller.rb
  113. +4 −4 railties/lib/rails/railtie.rb
  114. +1 −1 railties/lib/rails/railtie/configurable.rb
  115. +1 −1 railties/test/application/loading_test.rb
  116. +4 −4 railties/test/generators/actions_test.rb
  117. +4 −4 railties/test/generators/named_base_test.rb
  118. +18 −18 railties/test/rails_info_test.rb
@@ -49,19 +49,19 @@ def determine_default_mailer(name)
end
end
- protected
+ protected
- def initialize_test_deliveries
- ActionMailer::Base.delivery_method = :test
- ActionMailer::Base.perform_deliveries = true
- ActionMailer::Base.deliveries.clear
- end
+ def initialize_test_deliveries
+ ActionMailer::Base.delivery_method = :test
+ ActionMailer::Base.perform_deliveries = true
+ ActionMailer::Base.deliveries.clear
+ end
- def set_expected_mail
- @expected = Mail.new
- @expected.content_type ["text", "plain", { "charset" => charset }]
- @expected.mime_version = '1.0'
- end
+ def set_expected_mail
+ @expected = Mail.new
+ @expected.content_type ["text", "plain", { "charset" => charset }]
+ @expected.mime_version = '1.0'
+ end
private
@@ -610,28 +610,28 @@ def notify
assert_equal Set.new(["notify"]), FooMailer.action_methods
end
- protected
-
- # Execute the block setting the given values and restoring old values after
- # the block is executed.
- def swap(klass, new_values)
- old_values = {}
- new_values.each do |key, value|
- old_values[key] = klass.send key
- klass.send :"#{key}=", value
- end
- yield
- ensure
- old_values.each do |key, value|
- klass.send :"#{key}=", value
- end
+protected
+
+ # Execute the block setting the given values and restoring old values after
+ # the block is executed.
+ def swap(klass, new_values)
+ old_values = {}
+ new_values.each do |key, value|
+ old_values[key] = klass.send key
+ klass.send :"#{key}=", value
end
-
- def with_default(klass, new_values)
- old = klass.default_params
- klass.default(new_values)
- yield
- ensure
- klass.default_params = old
+ yield
+ ensure
+ old_values.each do |key, value|
+ klass.send :"#{key}=", value
end
+ end
+
+ def with_default(klass, new_values)
+ old = klass.default_params
+ klass.default(new_values)
+ yield
+ ensure
+ klass.default_params = old
+ end
end
@@ -59,7 +59,7 @@ def use_block_format
end
end
- protected
+protected
def mail_with_defaults(&block)
mail(:to => "test@localhost", :from => "tester@example.com",
@@ -67,16 +67,16 @@ def after(controller)
self.controller = nil
end
- protected
- # gets the action cache path for the given options.
- def action_path_for(options)
- Actions::ActionCachePath.new(controller, options).path
- end
+ protected
+ # gets the action cache path for the given options.
+ def action_path_for(options)
+ Actions::ActionCachePath.new(controller, options).path
+ end
- # Retrieve instance variables set in the controller.
- def assigns(key)
- controller.instance_variable_get("@#{key}")
- end
+ # Retrieve instance variables set in the controller.
+ def assigns(key)
+ controller.instance_variable_get("@#{key}")
+ end
private
def callback(timing)
@@ -13,103 +13,103 @@ module DataStreaming
:disposition => 'attachment'.freeze,
}.freeze
- protected
- # Sends the file. This uses a server-appropriate method (such as X-Sendfile)
- # via the Rack::Sendfile middleware. The header to use is set via
- # config.action_dispatch.x_sendfile_header.
- # Your server can also configure this for you by setting the X-Sendfile-Type header.
- #
- # Be careful to sanitize the path parameter if it is coming from a web
- # page. <tt>send_file(params[:path])</tt> allows a malicious user to
- # download any file on your server.
- #
- # Options:
- # * <tt>:filename</tt> - suggests a filename for the browser to use.
- # Defaults to <tt>File.basename(path)</tt>.
- # * <tt>:type</tt> - specifies an HTTP content type.
- # You can specify either a string or a symbol for a registered type register with
- # <tt>Mime::Type.register</tt>, for example :json
- # If omitted, type will be guessed from the file extension specified in <tt>:filename</tt>.
- # If no content type is registered for the extension, default type 'application/octet-stream' will be used.
- # * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
- # Valid values are 'inline' and 'attachment' (default).
- # * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
- # * <tt>:url_based_filename</tt> - set to +true+ if you want the browser guess the filename from
- # the URL, which is necessary for i18n filenames on certain browsers
- # (setting <tt>:filename</tt> overrides this option).
- #
- # The default Content-Type and Content-Disposition headers are
- # set to download arbitrary binary files in as many browsers as
- # possible. IE versions 4, 5, 5.5, and 6 are all known to have
- # a variety of quirks (especially when downloading over SSL).
- #
- # Simple download:
- #
- # send_file '/path/to.zip'
- #
- # Show a JPEG in the browser:
- #
- # send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
- #
- # Show a 404 page in the browser:
- #
- # send_file '/path/to/404.html', :type => 'text/html; charset=utf-8', :status => 404
- #
- # Read about the other Content-* HTTP headers if you'd like to
- # provide the user with more information (such as Content-Description) in
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11.
- #
- # Also be aware that the document may be cached by proxies and browsers.
- # The Pragma and Cache-Control headers declare how the file may be cached
- # by intermediaries. They default to require clients to validate with
- # the server before releasing cached responses. See
- # http://www.mnot.net/cache_docs/ for an overview of web caching and
- # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
- # for the Cache-Control header spec.
- def send_file(path, options = {}) #:doc:
- raise MissingFile, "Cannot read file #{path}" unless File.file?(path) and File.readable?(path)
+ protected
+ # Sends the file. This uses a server-appropriate method (such as X-Sendfile)
+ # via the Rack::Sendfile middleware. The header to use is set via
+ # config.action_dispatch.x_sendfile_header.
+ # Your server can also configure this for you by setting the X-Sendfile-Type header.
+ #
+ # Be careful to sanitize the path parameter if it is coming from a web
+ # page. <tt>send_file(params[:path])</tt> allows a malicious user to
+ # download any file on your server.
+ #
+ # Options:
+ # * <tt>:filename</tt> - suggests a filename for the browser to use.
+ # Defaults to <tt>File.basename(path)</tt>.
+ # * <tt>:type</tt> - specifies an HTTP content type.
+ # You can specify either a string or a symbol for a registered type register with
+ # <tt>Mime::Type.register</tt>, for example :json
+ # If omitted, type will be guessed from the file extension specified in <tt>:filename</tt>.
+ # If no content type is registered for the extension, default type 'application/octet-stream' will be used.
+ # * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
+ # Valid values are 'inline' and 'attachment' (default).
+ # * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
+ # * <tt>:url_based_filename</tt> - set to +true+ if you want the browser guess the filename from
+ # the URL, which is necessary for i18n filenames on certain browsers
+ # (setting <tt>:filename</tt> overrides this option).
+ #
+ # The default Content-Type and Content-Disposition headers are
+ # set to download arbitrary binary files in as many browsers as
+ # possible. IE versions 4, 5, 5.5, and 6 are all known to have
+ # a variety of quirks (especially when downloading over SSL).
+ #
+ # Simple download:
+ #
+ # send_file '/path/to.zip'
+ #
+ # Show a JPEG in the browser:
+ #
+ # send_file '/path/to.jpeg', :type => 'image/jpeg', :disposition => 'inline'
+ #
+ # Show a 404 page in the browser:
+ #
+ # send_file '/path/to/404.html', :type => 'text/html; charset=utf-8', :status => 404
+ #
+ # Read about the other Content-* HTTP headers if you'd like to
+ # provide the user with more information (such as Content-Description) in
+ # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.11.
+ #
+ # Also be aware that the document may be cached by proxies and browsers.
+ # The Pragma and Cache-Control headers declare how the file may be cached
+ # by intermediaries. They default to require clients to validate with
+ # the server before releasing cached responses. See
+ # http://www.mnot.net/cache_docs/ for an overview of web caching and
+ # http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9
+ # for the Cache-Control header spec.
+ def send_file(path, options = {}) #:doc:
+ raise MissingFile, "Cannot read file #{path}" unless File.file?(path) and File.readable?(path)
- options[:filename] ||= File.basename(path) unless options[:url_based_filename]
- send_file_headers! options
+ options[:filename] ||= File.basename(path) unless options[:url_based_filename]
+ send_file_headers! options
- self.status = options[:status] || 200
- self.content_type = options[:content_type] if options.key?(:content_type)
- self.response_body = File.open(path, "rb")
- end
+ self.status = options[:status] || 200
+ self.content_type = options[:content_type] if options.key?(:content_type)
+ self.response_body = File.open(path, "rb")
+ end
- # Sends the given binary data to the browser. This method is similar to
- # <tt>render :text => data</tt>, but also allows you to specify whether
- # the browser should display the response as a file attachment (i.e. in a
- # download dialog) or as inline data. You may also set the content type,
- # the apparent file name, and other things.
- #
- # Options:
- # * <tt>:filename</tt> - suggests a filename for the browser to use.
- # * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
- # either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
- # If omitted, type will be guessed from the file extension specified in <tt>:filename</tt>.
- # If no content type is registered for the extension, default type 'application/octet-stream' will be used.
- # * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
- # Valid values are 'inline' and 'attachment' (default).
- # * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
- #
- # Generic data download:
- #
- # send_data buffer
- #
- # Download a dynamically-generated tarball:
- #
- # send_data generate_tgz('dir'), :filename => 'dir.tgz'
- #
- # Display an image Active Record in the browser:
- #
- # send_data image.data, :type => image.content_type, :disposition => 'inline'
- #
- # See +send_file+ for more information on HTTP Content-* headers and caching.
- def send_data(data, options = {}) #:doc:
- send_file_headers! options.dup
- render options.slice(:status, :content_type).merge(:text => data)
- end
+ # Sends the given binary data to the browser. This method is similar to
+ # <tt>render :text => data</tt>, but also allows you to specify whether
+ # the browser should display the response as a file attachment (i.e. in a
+ # download dialog) or as inline data. You may also set the content type,
+ # the apparent file name, and other things.
+ #
+ # Options:
+ # * <tt>:filename</tt> - suggests a filename for the browser to use.
+ # * <tt>:type</tt> - specifies an HTTP content type. Defaults to 'application/octet-stream'. You can specify
+ # either a string or a symbol for a registered type register with <tt>Mime::Type.register</tt>, for example :json
+ # If omitted, type will be guessed from the file extension specified in <tt>:filename</tt>.
+ # If no content type is registered for the extension, default type 'application/octet-stream' will be used.
+ # * <tt>:disposition</tt> - specifies whether the file will be shown inline or downloaded.
+ # Valid values are 'inline' and 'attachment' (default).
+ # * <tt>:status</tt> - specifies the status code to send with the response. Defaults to 200.
+ #
+ # Generic data download:
+ #
+ # send_data buffer
+ #
+ # Download a dynamically-generated tarball:
+ #
+ # send_data generate_tgz('dir'), :filename => 'dir.tgz'
+ #
+ # Display an image Active Record in the browser:
+ #
+ # send_data image.data, :type => image.content_type, :disposition => 'inline'
+ #
+ # See +send_file+ for more information on HTTP Content-* headers and caching.
+ def send_data(data, options = {}) #:doc:
+ send_file_headers! options.dup
+ render options.slice(:status, :content_type).merge(:text => data)
+ end
private
def send_file_headers!(options)
@@ -8,21 +8,21 @@ module Flash
helper_method :alert, :notice
end
- protected
- def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
- if alert = response_status_and_flash.delete(:alert)
- flash[:alert] = alert
- end
-
- if notice = response_status_and_flash.delete(:notice)
- flash[:notice] = notice
- end
+ protected
+ def redirect_to(options = {}, response_status_and_flash = {}) #:doc:
+ if alert = response_status_and_flash.delete(:alert)
+ flash[:alert] = alert
+ end
- if other_flashes = response_status_and_flash.delete(:flash)
- flash.update(other_flashes)
- end
+ if notice = response_status_and_flash.delete(:notice)
+ flash[:notice] = notice
+ end
- super(options, response_status_and_flash)
+ if other_flashes = response_status_and_flash.delete(:flash)
+ flash.update(other_flashes)
end
+
+ super(options, response_status_and_flash)
+ end
end
end
Oops, something went wrong.

0 comments on commit e875ad0

Please sign in to comment.