Permalink
Browse files

Sync 'rails/rails/master'

  • Loading branch information...
wycats committed Jan 30, 2009
2 parents b8fadd7 + ed0e564 commit da10673e32718d6a0619bd0f4b4d3d796db86a1a
Showing with 14,070 additions and 14,977 deletions.
  1. +2 −0 .gitignore
  2. +1 −1 actionmailer/MIT-LICENSE
  3. +1 −1 actionmailer/lib/action_mailer.rb
  4. +13 −7 actionmailer/lib/action_mailer/base.rb
  5. +12 −0 actionmailer/test/mail_service_test.rb
  6. +4 −2 actionmailer/test/quoting_test.rb
  7. +36 −0 actionpack/CHANGELOG
  8. +1 −1 actionpack/MIT-LICENSE
  9. +3 −3 actionpack/lib/action_controller.rb
  10. +15 −8 actionpack/lib/action_controller/assertions/selector_assertions.rb
  11. +4 −12 actionpack/lib/action_controller/base.rb
  12. +2 −2 actionpack/lib/action_controller/caching/sweeping.rb
  13. +7 −5 actionpack/lib/action_controller/flash.rb
  14. +173 −23 actionpack/lib/action_controller/http_authentication.rb
  15. +1 −1 actionpack/lib/action_controller/layout.rb
  16. +0 −16 actionpack/lib/action_controller/lock.rb
  17. +10 −5 actionpack/lib/action_controller/middleware_stack.rb
  18. +4 −5 actionpack/lib/action_controller/middlewares.rb
  19. +71 −0 actionpack/lib/action_controller/params_parser.rb
  20. +3 −22 actionpack/lib/action_controller/rack_ext.rb
  21. +21 −0 actionpack/lib/action_controller/rack_ext/lock.rb
  22. +22 −0 actionpack/lib/action_controller/rack_ext/multipart.rb
  23. +18 −0 actionpack/lib/action_controller/rack_ext/parse_query.rb
  24. +42 −38 actionpack/lib/action_controller/request.rb
  25. +0 −315 actionpack/lib/action_controller/request_parser.rb
  26. +0 −168 actionpack/lib/action_controller/request_profiler.rb
  27. +7 −23 actionpack/lib/action_controller/rewindable_input.rb
  28. +2 −3 actionpack/lib/action_controller/routing.rb
  29. +4 −2 actionpack/lib/action_controller/session/abstract_store.rb
  30. +5 −5 actionpack/lib/action_controller/session/cookie_store.rb
  31. +1 −1 actionpack/lib/action_controller/session_management.rb
  32. +46 −21 actionpack/lib/action_controller/test_process.rb
  33. +7 −0 actionpack/lib/action_controller/uploaded_file.rb
  34. +61 −0 actionpack/lib/action_controller/url_encoded_pair_parser.rb
  35. +3 −6 actionpack/lib/action_controller/url_rewriter.rb
  36. +1 −1 actionpack/lib/action_pack.rb
  37. +1 −1 actionpack/lib/action_view.rb
  38. +74 −50 actionpack/lib/action_view/helpers/asset_tag_helper.rb
  39. +5 −5 actionpack/lib/action_view/helpers/date_helper.rb
  40. +58 −1 actionpack/lib/action_view/helpers/form_options_helper.rb
  41. +28 −17 actionpack/lib/action_view/helpers/number_helper.rb
  42. +1 −1 actionpack/lib/action_view/helpers/text_helper.rb
  43. +12 −1 actionpack/lib/action_view/locale/en.yml
  44. +8 −1 actionpack/lib/action_view/paths.rb
  45. +43 −15 actionpack/lib/action_view/template.rb
  46. +5 −1 actionpack/lib/action_view/template_handlers.rb
  47. +4 −0 actionpack/test/abstract_unit.rb
  48. +0 −54 actionpack/test/controller/http_authentication_test.rb
  49. +88 −0 actionpack/test/controller/http_basic_authentication_test.rb
  50. +130 −0 actionpack/test/controller/http_digest_authentication_test.rb
  51. +6 −0 actionpack/test/controller/middleware_stack_test.rb
  52. +14 −14 actionpack/test/controller/rack_test.rb
  53. +8 −0 actionpack/test/controller/render_test.rb
  54. +18 −3 actionpack/test/controller/request/multipart_params_parsing_test.rb
  55. +12 −0 actionpack/test/controller/request/url_encoded_params_parsing_test.rb
  56. +29 −29 actionpack/test/controller/request_test.rb
  57. +34 −6 actionpack/test/controller/session/cookie_store_test.rb
  58. +58 −0 actionpack/test/controller/session/test_session_test.rb
  59. +23 −0 actionpack/test/controller/test_test.rb
  60. +16 −1 actionpack/test/controller/url_rewriter_test.rb
  61. +10 −0 actionpack/test/fixtures/multipart/empty
  62. +9 −0 actionpack/test/fixtures/multipart/none
  63. +1 −1 actionpack/test/fixtures/replies.yml
  64. +1 −0 actionpack/test/fixtures/test/hello_world.da.html.erb
  65. +1 −0 actionpack/test/fixtures/test/render_implicit_html_template_from_xhr_request.html.erb
  66. +80 −15 actionpack/test/template/date_helper_test.rb
  67. +42 −0 actionpack/test/template/form_options_helper_test.rb
  68. +19 −5 actionpack/test/template/number_helper_i18n_test.rb
  69. +15 −0 actionpack/test/template/render_test.rb
  70. +23 −0 actionpack/test/template/text_helper_test.rb
  71. +6 −2 activerecord/CHANGELOG
  72. +1 −1 activerecord/MIT-LICENSE
  73. +6 −2 activerecord/Rakefile
  74. +1 −1 activerecord/lib/active_record.rb
  75. +2 −2 activerecord/lib/active_record/associations.rb
  76. +9 −3 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
  77. +98 −53 activerecord/lib/active_record/base.rb
  78. +16 −8 activerecord/lib/active_record/calculations.rb
  79. +4 −3 activerecord/lib/active_record/callbacks.rb
  80. +5 −2 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  81. +1 −1 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  82. +2 −2 activerecord/lib/active_record/dirty.rb
  83. +1 −1 activerecord/lib/active_record/locale/en.yml
  84. +1 −1 activerecord/lib/active_record/named_scope.rb
  85. +8 −0 activerecord/lib/active_record/reflection.rb
  86. +1 −1 activerecord/lib/active_record/validations.rb
  87. +11 −0 activerecord/test/cases/associations/has_and_belongs_to_many_associations_test.rb
  88. +2 −1 activerecord/test/cases/associations/has_many_associations_test.rb
  89. +7 −0 activerecord/test/cases/base_test.rb
  90. +41 −3 activerecord/test/cases/callbacks_test.rb
  91. +26 −0 activerecord/test/cases/connection_test_mysql.rb
  92. +11 −0 activerecord/test/cases/copy_table_test_sqlite.rb
  93. +25 −1 activerecord/test/cases/dirty_test.rb
  94. +1 −1 activerecord/test/cases/helper.rb
  95. +1 −1 activerecord/test/cases/json_serialization_test.rb
  96. +10 −0 activerecord/test/cases/method_scoping_test.rb
  97. +20 −0 activerecord/test/cases/named_scope_test.rb
  98. +18 −0 activerecord/test/connections/jdbc_jdbcderby/connection.rb
  99. +18 −0 activerecord/test/connections/jdbc_jdbch2/connection.rb
  100. +18 −0 activerecord/test/connections/jdbc_jdbchsqldb/connection.rb
  101. +26 −0 activerecord/test/connections/jdbc_jdbcmysql/connection.rb
  102. +26 −0 activerecord/test/connections/jdbc_jdbcpostgresql/connection.rb
  103. +25 −0 activerecord/test/connections/jdbc_jdbcsqlite3/connection.rb
  104. +6 −0 activerecord/test/models/post.rb
  105. +2 −0 activerecord/test/models/topic.rb
  106. +6 −0 activerecord/test/schema/schema.rb
  107. +1 −1 activeresource/MIT-LICENSE
  108. +3 −3 activeresource/lib/active_resource/base.rb
  109. +9 −0 activeresource/test/base/equality_test.rb
  110. +14 −1 activeresource/test/base_test.rb
  111. +1 −1 activesupport/MIT-LICENSE
  112. +4 −0 activesupport/lib/active_support/cache.rb
  113. +6 −1 activesupport/lib/active_support/cache/mem_cache_store.rb
  114. +104 −0 activesupport/lib/active_support/cache/strategy/local_cache.rb
  115. +3 −3 activesupport/lib/active_support/core_ext/date/conversions.rb
  116. +1 −1 activesupport/lib/active_support/core_ext/date_time/conversions.rb
  117. +1 −1 activesupport/lib/active_support/core_ext/hash/conversions.rb
  118. +1 −1 activesupport/lib/active_support/core_ext/hash/keys.rb
  119. +0 −17 activesupport/lib/active_support/core_ext/object/misc.rb
  120. +1 −1 activesupport/lib/active_support/core_ext/range/conversions.rb
  121. +30 −0 activesupport/lib/active_support/core_ext/try.rb
  122. +14 −5 activesupport/lib/active_support/dependencies.rb
  123. +1 −1 activesupport/lib/active_support/json/encoders/date.rb
  124. +1 −1 activesupport/lib/active_support/json/encoders/date_time.rb
  125. +2 −2 activesupport/lib/active_support/json/encoders/hash.rb
  126. +1 −1 activesupport/lib/active_support/json/encoders/time.rb
  127. +26 −9 activesupport/lib/active_support/ordered_hash.rb
  128. +1 −1 activesupport/lib/active_support/time_with_zone.rb
  129. +5 −0 activesupport/lib/active_support/vendor/i18n-0.1.1/lib/i18n.rb
  130. +7 −1 activesupport/lib/active_support/vendor/i18n-0.1.1/lib/i18n/backend/simple.rb
  131. +22 −0 activesupport/lib/active_support/vendor/i18n-0.1.1/test/simple_backend_test.rb
  132. +117 −16 activesupport/test/caching_test.rb
  133. +2 −2 activesupport/test/core_ext/integer_ext_test.rb
  134. +2 −2 activesupport/test/json/encoding_test.rb
  135. +9 −1 activesupport/test/ordered_hash_test.rb
  136. +2 −2 ci/geminstaller.yml
  137. +6 −0 railties/CHANGELOG
  138. +1 −1 railties/MIT-LICENSE
  139. +13 −3 railties/Rakefile
  140. +0 −3 railties/bin/performance/request
  141. +2 −5 railties/doc/README_FOR_APP
  142. +229 −413 railties/doc/guides/html/2_2_release_notes.html
  143. +197 −0 railties/doc/guides/html/action_mailer_basics.html
  144. +245 −479 railties/doc/guides/html/actioncontroller_basics.html
  145. +445 −647 railties/doc/guides/html/{finders.html → active_record_querying.html}
  146. +607 −596 railties/doc/guides/html/activerecord_validations_callbacks.html
  147. +461 −734 railties/doc/guides/html/association_basics.html
  148. +45 −203 railties/doc/guides/html/authors.html
  149. +0 −1,018 railties/doc/guides/html/benchmarking_and_profiling.html
  150. +131 −318 railties/doc/guides/html/caching_with_rails.html
  151. +210 −291 railties/doc/guides/html/command_line.html
  152. +261 −355 railties/doc/guides/html/configuring.html
  153. +346 −562 railties/doc/guides/html/creating_plugins.html
  154. +241 −424 railties/doc/guides/html/debugging_rails_applications.html
  155. +652 −320 railties/doc/guides/html/form_helpers.html
  156. +485 −824 railties/doc/guides/html/getting_started_with_rails.html
  157. +534 −762 railties/doc/guides/html/i18n.html
  158. +85 −225 railties/doc/guides/html/index.html
  159. +408 −536 railties/doc/guides/html/layouts_and_rendering.html
  160. +233 −424 railties/doc/guides/html/migrations.html
  161. +728 −0 railties/doc/guides/html/performance_testing.html
  162. +450 −0 railties/doc/guides/html/rails_on_rack.html
  163. +688 −1,310 railties/doc/guides/html/routing_outside_in.html
  164. +423 −616 railties/doc/guides/html/security.html
  165. +1,011 −881 railties/doc/guides/html/testing_rails_applications.html
  166. +133 −0 railties/doc/guides/source/action_mailer_basics.txt
  167. +1 −32 railties/doc/guides/source/actioncontroller_basics/session.txt
  168. +1 −28 railties/doc/guides/source/active_record_basics.txt
  169. +71 −91 railties/doc/guides/source/{finders.txt → active_record_querying.txt}
  170. +260 −106 railties/doc/guides/source/activerecord_validations_callbacks.txt
  171. +12 −0 railties/doc/guides/source/authors.txt
  172. +0 −95 railties/doc/guides/source/benchmarking_and_profiling/appendix.txt
  173. +0 −105 railties/doc/guides/source/benchmarking_and_profiling/digging_deeper.txt
  174. +0 −185 railties/doc/guides/source/benchmarking_and_profiling/edge_rails_features.txt
  175. +0 −27 railties/doc/guides/source/benchmarking_and_profiling/gameplan.txt
  176. +0 −242 railties/doc/guides/source/benchmarking_and_profiling/index.txt
  177. +0 −179 railties/doc/guides/source/benchmarking_and_profiling/rubyprof.txt
  178. +0 −57 railties/doc/guides/source/benchmarking_and_profiling/statistics.txt
  179. +4 −4 railties/doc/guides/source/caching_with_rails.txt
  180. +67 −22 railties/doc/guides/source/configuring.txt
  181. +382 −82 railties/doc/guides/source/form_helpers.txt
  182. +35 −37 railties/doc/guides/source/getting_started_with_rails.txt
  183. +73 −51 railties/doc/guides/source/i18n.txt
  184. BIN railties/doc/guides/source/images/customized_error_messages.png
  185. BIN railties/doc/guides/source/images/error_messages.png
  186. BIN railties/doc/guides/source/images/validation_error_messages.png
  187. +26 −9 railties/doc/guides/source/index.txt
  188. +106 −11 railties/doc/guides/source/layouts_and_rendering.txt
  189. +560 −0 railties/doc/guides/source/performance_testing.txt
  190. +256 −0 railties/doc/guides/source/rails_on_rack.txt
  191. +55 −60 railties/doc/guides/source/routing_outside_in.txt
  192. +160 −160 railties/doc/guides/source/stylesheets/base.css
  193. +4 −4 railties/doc/guides/source/stylesheets/forms.css
  194. +176 −5 railties/doc/guides/source/stylesheets/more.css
  195. +83 −86 railties/doc/guides/source/templates/guides.html.erb
  196. +0 −165 railties/doc/guides/source/templates/inline.css
  197. +96 −87 railties/doc/guides/source/testing_rails_applications.txt
  198. +17 −1 railties/lib/commands/dbconsole.rb
  199. +0 −6 railties/lib/commands/performance/request.rb
  200. +1 −1 railties/lib/dispatcher.rb
  201. +11 −2 railties/lib/initializer.rb
  202. +1 −1 railties/lib/rails_generator/generators/applications/app/app_generator.rb
  203. +7 −1 railties/lib/rails_generator/generators/applications/app/template_runner.rb
  204. +2 −2 railties/lib/tasks/gems.rake
  205. +1 −0 railties/lib/tasks/misc.rake
View
@@ -15,3 +15,5 @@ railties/test/500.html
railties/doc/guides/html/images
railties/doc/guides/html/stylesheets
*.rbc
+*.swp
+*.swo
View
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2008 David Heinemeier Hansson
+Copyright (c) 2004-2009 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2008 David Heinemeier Hansson
+# Copyright (c) 2004-2009 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -213,6 +213,8 @@ module ActionMailer #:nodoc:
# * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
# * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here.
# This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>.
+ # * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server and starts to use it.
+ # It works only on Ruby >= 1.8.7 and Ruby >= 1.9. Default is true.
#
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
# * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
@@ -230,10 +232,13 @@ module ActionMailer #:nodoc:
#
# * <tt>default_charset</tt> - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
# pick a different charset from inside a method with +charset+.
+ #
# * <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to "text/plain". You
# can also pick a different content type from inside a method with +content_type+.
+ #
# * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to <tt>1.0</tt>. You
# can also pick a different value from inside a method with +mime_version+.
+ #
# * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
# which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
# <tt>["text/html", "text/enriched", "text/plain"]</tt>. Items that appear first in the array have higher priority in the mail client
@@ -252,12 +257,13 @@ class Base
cattr_accessor :logger
@@smtp_settings = {
- :address => "localhost",
- :port => 25,
- :domain => 'localhost.localdomain',
- :user_name => nil,
- :password => nil,
- :authentication => nil
+ :address => "localhost",
+ :port => 25,
+ :domain => 'localhost.localdomain',
+ :user_name => nil,
+ :password => nil,
+ :authentication => nil,
+ :enable_starttls_auto => true,
}
cattr_accessor :smtp_settings
@@ -669,7 +675,7 @@ def perform_delivery_smtp(mail)
sender = mail['return-path'] || mail.from
smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port])
- smtp.enable_starttls_auto if smtp.respond_to?(:enable_starttls_auto)
+ smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto)
smtp.start(smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password],
smtp_settings[:authentication]) do |smtp|
smtp.sendmail(mail.encoded, sender, destinations)
@@ -948,18 +948,30 @@ def test_body_is_stored_as_an_ivar
end
def test_starttls_is_enabled_if_supported
+ ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
MockSMTP.any_instance.expects(:respond_to?).with(:enable_starttls_auto).returns(true)
MockSMTP.any_instance.expects(:enable_starttls_auto)
ActionMailer::Base.delivery_method = :smtp
TestMailer.deliver_signed_up(@recipient)
end
def test_starttls_is_disabled_if_not_supported
+ ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
MockSMTP.any_instance.expects(:respond_to?).with(:enable_starttls_auto).returns(false)
MockSMTP.any_instance.expects(:enable_starttls_auto).never
ActionMailer::Base.delivery_method = :smtp
TestMailer.deliver_signed_up(@recipient)
end
+
+ def test_starttls_is_not_enabled
+ ActionMailer::Base.smtp_settings[:enable_starttls_auto] = false
+ MockSMTP.any_instance.expects(:respond_to?).never
+ MockSMTP.any_instance.expects(:enable_starttls_auto).never
+ ActionMailer::Base.delivery_method = :smtp
+ TestMailer.deliver_signed_up(@recipient)
+ ensure
+ ActionMailer::Base.smtp_settings[:enable_starttls_auto] = true
+ end
end
end # uses_mocha
@@ -48,8 +48,10 @@ def test_quote_multibyte_chars
result = execute_in_sandbox(<<-CODE)
$:.unshift(File.dirname(__FILE__) + "/../lib/")
- $KCODE = 'u'
- require 'jcode'
+ if RUBY_VERSION < '1.9'
+ $KCODE = 'u'
+ require 'jcode'
+ end
require 'action_mailer/quoting'
include ActionMailer::Quoting
quoted_printable(#{original.inspect}, "UTF-8")
View
@@ -1,5 +1,41 @@
*2.3.0 [Edge]*
+* Added grouped_options_for_select helper method for wrapping option tags in optgroups. #977 [Jon Crawford]
+
+* Implement HTTP Digest authentication. #1230 [Gregg Kellogg, Pratik Naik] Example :
+
+ class DummyDigestController < ActionController::Base
+ USERS = { "lifo" => 'world' }
+
+ before_filter :authenticate
+
+ def index
+ render :text => "Hello Secret"
+ end
+
+ private
+
+ def authenticate
+ authenticate_or_request_with_http_digest("Super Secret") do |username|
+ # Return the user's password
+ USERS[username]
+ end
+ end
+ end
+
+* Improved i18n support for the number_to_human_size helper. Changes the storage_units translation data; update your translations accordingly. #1634 [Yaroslav Markin]
+ storage_units:
+ # %u is the storage unit, %n is the number (default: 2 MB)
+ format: "%n %u"
+ units:
+ byte:
+ one: "Byte"
+ other: "Bytes"
+ kb: "KB"
+ mb: "MB"
+ gb: "GB"
+ tb: "TB"
+
* Added :silence option to BenchmarkHelper#benchmark and turned log_level into a hash parameter and deprecated the old use [DHH]
* Fixed the AssetTagHelper cache to use the computed asset host as part of the cache key instead of just assuming the its a string #1299 [DHH]
View
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2008 David Heinemeier Hansson
+Copyright (c) 2004-2009 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2008 David Heinemeier Hansson
+# Copyright (c) 2004-2009 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@ -56,14 +56,13 @@ def self.load_all!
autoload :Integration, 'action_controller/integration'
autoload :IntegrationTest, 'action_controller/integration'
autoload :Layout, 'action_controller/layout'
- autoload :Lock, 'action_controller/lock'
autoload :MiddlewareStack, 'action_controller/middleware_stack'
autoload :MimeResponds, 'action_controller/mime_responds'
+ autoload :ParamsParser, 'action_controller/params_parser'
autoload :PolymorphicRoutes, 'action_controller/polymorphic_routes'
autoload :RecordIdentifier, 'action_controller/record_identifier'
autoload :Request, 'action_controller/request'
autoload :RequestForgeryProtection, 'action_controller/request_forgery_protection'
- autoload :RequestParser, 'action_controller/request_parser'
autoload :Rescue, 'action_controller/rescue'
autoload :Resources, 'action_controller/resources'
autoload :Response, 'action_controller/response'
@@ -75,6 +74,7 @@ def self.load_all!
autoload :TestCase, 'action_controller/test_case'
autoload :TestProcess, 'action_controller/test_process'
autoload :Translation, 'action_controller/translation'
+ autoload :UploadedFile, 'action_controller/uploaded_file'
autoload :UploadedStringIO, 'action_controller/uploaded_file'
autoload :UploadedTempfile, 'action_controller/uploaded_file'
autoload :UrlEncodedPairParser, 'action_controller/url_encoded_pair_parser'
@@ -109,20 +109,27 @@ def css_select(*args)
# starting from (and including) that element and all its children in
# depth-first order.
#
- # If no element if specified, calling +assert_select+ will select from the
- # response HTML. Calling #assert_select inside an +assert_select+ block will
- # run the assertion for each element selected by the enclosing assertion.
+ # If no element if specified, calling +assert_select+ selects from the
+ # response HTML unless +assert_select+ is called from within an +assert_select+ block.
+ #
+ # When called with a block +assert_select+ passes an array of selected elements
+ # to the block. Calling +assert_select+ from the block, with no element specified,
+ # runs the assertion on the complete set of elements selected by the enclosing assertion.
+ # Alternatively the array may be iterated through so that +assert_select+ can be called
+ # separately for each element.
+ #
#
# ==== Example
- # assert_select "ol>li" do |elements|
+ # If the response contains two ordered lists, each with four list elements then:
+ # assert_select "ol" do |elements|
# elements.each do |element|
- # assert_select element, "li"
+ # assert_select element, "li", 4
# end
# end
#
- # Or for short:
- # assert_select "ol>li" do
- # assert_select "li"
+ # will pass, as will:
+ # assert_select "ol" do
+ # assert_select "li", 8
# end
#
# The selector may be a CSS selector expression (String), an expression
@@ -301,10 +301,7 @@ class Base
# A YAML parser is also available and can be turned on with:
#
# ActionController::Base.param_parsers[Mime::YAML] = :yaml
- @@param_parsers = { Mime::MULTIPART_FORM => :multipart_form,
- Mime::URL_ENCODED_FORM => :url_encoded_form,
- Mime::XML => :xml_simple,
- Mime::JSON => :json }
+ @@param_parsers = {}
cattr_accessor :param_parsers
# Controls the default charset for all renders.
@@ -647,7 +644,7 @@ def controller_path
end
def session_enabled?
- request.session_options && request.session_options[:disabled] != false
+ ActiveSupport::Deprecation.warn("Sessions are now lazy loaded. So if you don't access them, consider them disabled.", caller)
end
self.view_paths = []
@@ -1318,10 +1315,6 @@ def complete_request_uri
"#{request.protocol}#{request.host}#{request.request_uri}"
end
- def close_session
- @_session.close if @_session && @_session.respond_to?(:close)
- end
-
def default_template(action_name = self.action_name)
self.view_paths.find_template(default_template_name(action_name), default_template_format)
end
@@ -1345,15 +1338,14 @@ def template_path_includes_controller?(path)
end
def process_cleanup
- close_session
end
end
Base.class_eval do
[ Filters, Layout, Benchmarking, Rescue, Flash, MimeResponds, Helpers,
Cookies, Caching, Verification, Streaming, SessionManagement,
- HttpAuthentication::Basic::ControllerMethods, RecordIdentifier,
- RequestForgeryProtection, Translation
+ HttpAuthentication::Basic::ControllerMethods, HttpAuthentication::Digest::ControllerMethods,
+ RecordIdentifier, RequestForgeryProtection, Translation
].each do |mod|
include mod
end
@@ -87,9 +87,9 @@ def callback(timing)
__send__(action_callback_method_name) if respond_to?(action_callback_method_name, true)
end
- def method_missing(method, *arguments)
+ def method_missing(method, *arguments, &block)
return if @controller.nil?
- @controller.__send__(method, *arguments)
+ @controller.__send__(method, *arguments, &block)
end
end
end
@@ -4,20 +4,22 @@ module ActionController #:nodoc:
# action that sets <tt>flash[:notice] = "Successfully created"</tt> before redirecting to a display action that can
# then expose the flash to its template. Actually, that exposure is automatically done. Example:
#
- # class WeblogController < ActionController::Base
+ # class PostsController < ActionController::Base
# def create
# # save post
# flash[:notice] = "Successfully created post"
- # redirect_to :action => "display", :params => { :id => post.id }
+ # redirect_to posts_path(@post)
# end
#
- # def display
+ # def show
# # doesn't need to assign the flash notice to the template, that's done automatically
# end
# end
#
- # display.erb
- # <% if flash[:notice] %><div class="notice"><%= flash[:notice] %></div><% end %>
+ # show.html.erb
+ # <% if flash[:notice] %>
+ # <div class="notice"><%= flash[:notice] %></div>
+ # <% end %>
#
# 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 as you like at a time too. Just remember: They'll be gone by the time the next action has been performed.
Oops, something went wrong.

0 comments on commit da10673

Please sign in to comment.