Permalink
Browse files

Merge remote branch 'mainstream/master'

  • Loading branch information...
2 parents 087b678 + 71d67fc commit c71120e29caddda295c133adfb279870733a3f81 @lifo lifo committed Jan 19, 2010
Showing with 1,497 additions and 1,308 deletions.
  1. +37 −4 actionmailer/lib/action_mailer/base.rb
  2. +16 −22 actionmailer/lib/action_mailer/deprecated_body.rb
  3. +4 −6 actionmailer/test/mail_service_test.rb
  4. +74 −66 actionpack/lib/abstract_controller/base.rb
  5. +1 −4 actionpack/lib/action_controller/deprecated/dispatcher.rb
  6. +3 −183 actionpack/lib/action_controller/metal/cookies.rb
  7. +0 −4 actionpack/lib/action_controller/metal/instrumentation.rb
  8. +3 −0 actionpack/lib/action_controller/metal/testing.rb
  9. +0 −50 actionpack/lib/action_controller/railtie.rb
  10. +1 −6 actionpack/lib/action_controller/railties/subscriber.rb
  11. +2 −0 actionpack/lib/action_dispatch.rb
  12. +1 −1 actionpack/lib/action_dispatch/http/response.rb
  13. +0 −2 actionpack/lib/action_dispatch/middleware/callbacks.rb
  14. +216 −0 actionpack/lib/action_dispatch/middleware/cookies.rb
  15. +24 −0 actionpack/lib/action_dispatch/middleware/notifications.rb
  16. +22 −10 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
  17. +8 −1 actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb
  18. +3 −3 actionpack/lib/action_dispatch/middleware/templates/rescues/_trace.erb
  19. +1 −1 actionpack/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb
  20. +29 −0 actionpack/lib/action_dispatch/railtie.rb
  21. +17 −0 actionpack/lib/action_dispatch/railties/subscriber.rb
  22. +25 −34 actionpack/lib/action_dispatch/routing/mapper.rb
  23. +2 −2 actionpack/lib/action_view/helpers/debug_helper.rb
  24. +1 −0 actionpack/test/abstract_unit.rb
  25. +2 −2 actionpack/test/activerecord/controller_runtime_test.rb
  26. +10 −27 actionpack/test/controller/cookie_test.rb
  27. +0 −27 actionpack/test/controller/filter_params_test.rb
  28. +1 −1 actionpack/test/controller/flash_test.rb
  29. +27 −1 actionpack/test/controller/new_base/base_test.rb
  30. +14 −28 actionpack/test/controller/subscriber_test.rb
  31. +0 −12 actionpack/test/dispatch/callbacks_test.rb
  32. +3 −6 actionpack/test/dispatch/response_test.rb
  33. +2 −2 actionpack/test/dispatch/session/cookie_store_test.rb
  34. +12 −33 actionpack/test/dispatch/show_exceptions_test.rb
  35. +112 −0 actionpack/test/dispatch/subscriber_test.rb
  36. +1 −1 actionpack/test/fixtures/reply.rb
  37. +2 −0 activemodel/lib/active_model/errors.rb
  38. +2 −0 activemodel/lib/active_model/validations/validates.rb
  39. +8 −0 activemodel/test/cases/validations_test.rb
  40. +10 −0 activerecord/CHANGELOG
  41. +7 −27 activerecord/lib/active_record/associations.rb
  42. +0 −2 activerecord/lib/active_record/associations/association_collection.rb
  43. +1 −1 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
  44. +1 −1 activerecord/lib/active_record/associations/has_many_association.rb
  45. +1 −1 activerecord/lib/active_record/associations/has_many_through_association.rb
  46. +5 −5 activerecord/lib/active_record/autosave_association.rb
  47. +5 −5 activerecord/lib/active_record/base.rb
  48. +10 −49 activerecord/lib/active_record/calculations.rb
  49. +1 −1 activerecord/lib/active_record/callbacks.rb
  50. +69 −84 activerecord/lib/active_record/named_scope.rb
  51. +1 −1 activerecord/lib/active_record/railties/databases.rake
  52. +1 −1 activerecord/lib/active_record/railties/subscriber.rb
  53. +12 −32 activerecord/lib/active_record/relation.rb
  54. +36 −0 activerecord/lib/active_record/relation/finder_methods.rb
  55. +2 −1 activerecord/lib/active_record/relation/predicate_builder.rb
  56. +10 −10 activerecord/lib/active_record/relation/spawn_methods.rb
  57. +2 −2 activerecord/lib/active_record/transactions.rb
  58. +11 −1 activerecord/lib/active_record/validations.rb
  59. +8 −0 {railties/lib/rails → activerecord/lib}/generators/active_record.rb
  60. +1 −1 {railties/lib/rails → activerecord/lib}/generators/active_record/migration/migration_generator.rb
  61. 0 {railties/lib/rails → activerecord/lib}/generators/active_record/migration/templates/migration.rb
  62. +1 −1 {railties/lib/rails → activerecord/lib}/generators/active_record/model/model_generator.rb
  63. 0 {railties/lib/rails → activerecord/lib}/generators/active_record/model/templates/migration.rb
  64. 0 {railties/lib/rails → activerecord/lib}/generators/active_record/model/templates/model.rb
  65. +1 −1 {railties/lib/rails → activerecord/lib}/generators/active_record/observer/observer_generator.rb
  66. 0 {railties/lib/rails → activerecord/lib}/generators/active_record/observer/templates/observer.rb
  67. +1 −1 ...ils → activerecord/lib}/generators/active_record/session_migration/session_migration_generator.rb
  68. 0 ...s/lib/rails → activerecord/lib}/generators/active_record/session_migration/templates/migration.rb
  69. +6 −6 activerecord/test/cases/autosave_association_test.rb
  70. +3 −1 activerecord/test/cases/base_test.rb
  71. +7 −7 activerecord/test/cases/method_scoping_test.rb
  72. +24 −19 activerecord/test/cases/named_scope_test.rb
  73. +10 −7 activerecord/test/cases/relations_test.rb
  74. +27 −2 activerecord/test/cases/validations_test.rb
  75. +3 −3 activerecord/test/models/comment.rb
  76. +3 −5 activerecord/test/models/company.rb
  77. +2 −2 activerecord/test/models/developer.rb
  78. +1 −1 activerecord/test/models/organization.rb
  79. +2 −2 activerecord/test/models/person.rb
  80. +9 −9 activerecord/test/models/post.rb
  81. +1 −1 activerecord/test/models/reply.rb
  82. +11 −11 activerecord/test/models/topic.rb
  83. +12 −3 activeresource/lib/active_resource/validations.rb
  84. +13 −0 activeresource/test/cases/validations_test.rb
  85. +24 −8 activesupport/lib/active_support/backtrace_cleaner.rb
  86. +4 −4 activesupport/lib/active_support/cache.rb
  87. +0 −47 activesupport/lib/active_support/core_ext/exception.rb
  88. +1 −1 activesupport/lib/active_support/notifications.rb
  89. +9 −0 activesupport/lib/active_support/notifications/instrumenter.rb
  90. +0 −69 activesupport/test/core_ext/exception_test.rb
  91. +16 −0 activesupport/test/notifications_test.rb
  92. +1 −1 railties/bin/rails
  93. 0 railties/lib/{rails → }/generators/erb.rb
  94. +1 −1 railties/lib/{rails → }/generators/erb/controller/controller_generator.rb
  95. 0 railties/lib/{rails → }/generators/erb/controller/templates/view.html.erb
  96. +1 −1 railties/lib/{rails → }/generators/erb/mailer/mailer_generator.rb
  97. 0 railties/lib/{rails → }/generators/erb/mailer/templates/view.erb
  98. +1 −1 railties/lib/{rails → }/generators/erb/scaffold/scaffold_generator.rb
  99. 0 railties/lib/{rails → }/generators/erb/scaffold/templates/_form.html.erb
  100. 0 railties/lib/{rails → }/generators/erb/scaffold/templates/edit.html.erb
  101. 0 railties/lib/{rails → }/generators/erb/scaffold/templates/index.html.erb
  102. 0 railties/lib/{rails → }/generators/erb/scaffold/templates/layout.html.erb
  103. 0 railties/lib/{rails → }/generators/erb/scaffold/templates/new.html.erb
  104. 0 railties/lib/{rails → }/generators/erb/scaffold/templates/show.html.erb
  105. 0 railties/lib/{rails → }/generators/rails/app/USAGE
  106. +3 −3 railties/lib/{rails → }/generators/rails/app/app_generator.rb
  107. 0 railties/lib/{rails → }/generators/rails/app/templates/Gemfile
  108. 0 railties/lib/{rails → }/generators/rails/app/templates/README
  109. 0 railties/lib/{rails → }/generators/rails/app/templates/Rakefile
  110. 0 railties/lib/{rails → }/generators/rails/app/templates/app/controllers/application_controller.rb
  111. 0 railties/lib/{rails → }/generators/rails/app/templates/app/helpers/application_helper.rb
  112. 0 railties/lib/{rails → }/generators/rails/app/templates/app/models/.empty_directory
  113. 0 railties/lib/{rails → }/generators/rails/app/templates/app/views/layouts/.empty_directory
  114. 0 railties/lib/{rails → }/generators/rails/app/templates/config.ru
  115. 0 railties/lib/{rails → }/generators/rails/app/templates/config/application.rb
  116. +12 −1 railties/lib/{rails → }/generators/rails/app/templates/config/boot.rb
  117. 0 railties/lib/{rails → }/generators/rails/app/templates/config/databases/frontbase.yml
  118. 0 railties/lib/{rails → }/generators/rails/app/templates/config/databases/ibm_db.yml
  119. 0 railties/lib/{rails → }/generators/rails/app/templates/config/databases/mysql.yml
  120. 0 railties/lib/{rails → }/generators/rails/app/templates/config/databases/oracle.yml
  121. 0 railties/lib/{rails → }/generators/rails/app/templates/config/databases/postgresql.yml
  122. 0 railties/lib/{rails → }/generators/rails/app/templates/config/databases/sqlite3.yml
  123. 0 railties/lib/{rails → }/generators/rails/app/templates/config/environment.rb
  124. 0 railties/lib/{rails → }/generators/rails/app/templates/config/environments/development.rb.tt
  125. 0 railties/lib/{rails → }/generators/rails/app/templates/config/environments/production.rb.tt
  126. 0 railties/lib/{rails → }/generators/rails/app/templates/config/environments/test.rb.tt
  127. 0 railties/lib/{rails → }/generators/rails/app/templates/config/initializers/backtrace_silencers.rb
  128. 0 ...ib/{rails → }/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt
  129. 0 railties/lib/{rails → }/generators/rails/app/templates/config/initializers/inflections.rb
  130. 0 railties/lib/{rails → }/generators/rails/app/templates/config/initializers/mime_types.rb
  131. 0 railties/lib/{rails → }/generators/rails/app/templates/config/initializers/session_store.rb.tt
  132. 0 railties/lib/{rails → }/generators/rails/app/templates/config/locales/en.yml
  133. 0 railties/lib/{rails → }/generators/rails/app/templates/config/routes.rb
  134. 0 railties/lib/{rails → }/generators/rails/app/templates/db/seeds.rb
  135. 0 railties/lib/{rails → }/generators/rails/app/templates/doc/README_FOR_APP
  136. 0 railties/lib/{rails → }/generators/rails/app/templates/gitignore
  137. 0 railties/lib/{rails → }/generators/rails/app/templates/public/404.html
  138. 0 railties/lib/{rails → }/generators/rails/app/templates/public/422.html
  139. 0 railties/lib/{rails → }/generators/rails/app/templates/public/500.html
  140. 0 railties/lib/{rails → }/generators/rails/app/templates/public/favicon.ico
  141. BIN railties/lib/{rails → }/generators/rails/app/templates/public/images/rails.png
  142. 0 railties/lib/{rails → }/generators/rails/app/templates/public/index.html
  143. 0 railties/lib/{rails → }/generators/rails/app/templates/public/javascripts/application.js
  144. 0 railties/lib/{rails → }/generators/rails/app/templates/public/javascripts/controls.js
  145. 0 railties/lib/{rails → }/generators/rails/app/templates/public/javascripts/dragdrop.js
  146. 0 railties/lib/{rails → }/generators/rails/app/templates/public/javascripts/effects.js
  147. 0 railties/lib/{rails → }/generators/rails/app/templates/public/javascripts/prototype.js
  148. 0 railties/lib/{rails → }/generators/rails/app/templates/public/robots.txt
  149. 0 railties/lib/{rails → }/generators/rails/app/templates/public/stylesheets/.empty_directory
  150. 0 railties/lib/{rails → }/generators/rails/app/templates/script/about
  151. 0 railties/lib/{rails → }/generators/rails/app/templates/script/console.tt
  152. 0 railties/lib/{rails → }/generators/rails/app/templates/script/dbconsole.tt
  153. 0 railties/lib/{rails → }/generators/rails/app/templates/script/destroy
  154. 0 railties/lib/{rails → }/generators/rails/app/templates/script/generate
  155. 0 railties/lib/{rails → }/generators/rails/app/templates/script/performance/benchmarker
  156. 0 railties/lib/{rails → }/generators/rails/app/templates/script/performance/profiler
  157. 0 railties/lib/{rails → }/generators/rails/app/templates/script/plugin
  158. 0 railties/lib/{rails → }/generators/rails/app/templates/script/runner
  159. 0 railties/lib/{rails → }/generators/rails/app/templates/script/server.tt
  160. 0 railties/lib/{rails → }/generators/rails/app/templates/test/fixtures/.empty_directory
  161. 0 railties/lib/{rails → }/generators/rails/app/templates/test/functional/.empty_directory
  162. 0 railties/lib/{rails → }/generators/rails/app/templates/test/integration/.empty_directory
  163. 0 railties/lib/{rails → }/generators/rails/app/templates/test/performance/browsing_test.rb
  164. 0 railties/lib/{rails → }/generators/rails/app/templates/test/test_helper.rb
  165. 0 railties/lib/{rails → }/generators/rails/app/templates/test/unit/.empty_directory
  166. 0 railties/lib/{rails → }/generators/rails/controller/USAGE
  167. 0 railties/lib/{rails → }/generators/rails/controller/controller_generator.rb
  168. 0 railties/lib/{rails → }/generators/rails/controller/templates/controller.rb
  169. 0 railties/lib/{rails → }/generators/rails/generator/USAGE
  170. 0 railties/lib/{rails → }/generators/rails/generator/generator_generator.rb
  171. 0 railties/lib/{rails → }/generators/rails/generator/templates/%file_name%_generator.rb.tt
  172. 0 railties/lib/{rails → }/generators/rails/generator/templates/USAGE.tt
  173. 0 railties/lib/{rails → }/generators/rails/generator/templates/templates/.empty_directory
  174. 0 railties/lib/{rails → }/generators/rails/helper/USAGE
  175. 0 railties/lib/{rails → }/generators/rails/helper/helper_generator.rb
  176. 0 railties/lib/{rails → }/generators/rails/helper/templates/helper.rb
  177. 0 railties/lib/{rails → }/generators/rails/integration_test/USAGE
  178. 0 railties/lib/{rails → }/generators/rails/integration_test/integration_test_generator.rb
  179. +2 −2 railties/lib/{rails → }/generators/rails/mailer/USAGE
  180. +1 −1 railties/lib/{rails → }/generators/rails/mailer/mailer_generator.rb
  181. 0 railties/lib/{rails → }/generators/rails/mailer/templates/mailer.rb
  182. 0 railties/lib/{rails → }/generators/rails/metal/USAGE
  183. 0 railties/lib/{rails → }/generators/rails/metal/metal_generator.rb
  184. 0 railties/lib/{rails → }/generators/rails/metal/templates/metal.rb
  185. 0 railties/lib/{rails → }/generators/rails/migration/USAGE
  186. 0 railties/lib/{rails → }/generators/rails/migration/migration_generator.rb
  187. 0 railties/lib/{rails → }/generators/rails/model/USAGE
  188. 0 railties/lib/{rails → }/generators/rails/model/model_generator.rb
  189. +1 −0 railties/lib/{rails → }/generators/rails/model_subclass/model_subclass_generator.rb
  190. 0 railties/lib/{rails → }/generators/rails/observer/USAGE
  191. 0 railties/lib/{rails → }/generators/rails/observer/observer_generator.rb
  192. 0 railties/lib/{rails → }/generators/rails/performance_test/USAGE
  193. 0 railties/lib/{rails → }/generators/rails/performance_test/performance_test_generator.rb
  194. 0 railties/lib/{rails → }/generators/rails/plugin/USAGE
  195. +7 −7 railties/lib/{rails → }/generators/rails/plugin/plugin_generator.rb
  196. 0 ...generators/rails/plugin/templates/MIT-LICENSE → generators/rails/plugin/templates/MIT-LICENSE.tt}
  197. 0 ...ib/{rails/generators/rails/plugin/templates/README → generators/rails/plugin/templates/README.tt}
  198. 0 ...rails/generators/rails/plugin/templates/Rakefile → generators/rails/plugin/templates/Rakefile.tt}
  199. 0 railties/lib/{rails → }/generators/rails/plugin/templates/init.rb
  200. 0 railties/lib/{rails → }/generators/rails/plugin/templates/install.rb
  201. 0 railties/lib/{rails → }/generators/rails/plugin/templates/lib/%file_name%.rb.tt
  202. 0 railties/lib/{rails → }/generators/rails/plugin/templates/tasks/%file_name%_tasks.rake.tt
  203. 0 railties/lib/{rails → }/generators/rails/plugin/templates/uninstall.rb
  204. 0 railties/lib/{rails → }/generators/rails/resource/USAGE
  205. +1 −1 railties/lib/{rails → }/generators/rails/resource/resource_generator.rb
  206. 0 railties/lib/{rails → }/generators/rails/scaffold/USAGE
  207. +1 −1 railties/lib/{rails → }/generators/rails/scaffold/scaffold_generator.rb
  208. 0 railties/lib/{rails → }/generators/rails/scaffold_controller/USAGE
  209. 0 railties/lib/{rails → }/generators/rails/scaffold_controller/scaffold_controller_generator.rb
  210. 0 railties/lib/{rails → }/generators/rails/scaffold_controller/templates/controller.rb
  211. 0 railties/lib/{rails → }/generators/rails/session_migration/USAGE
  212. 0 railties/lib/{rails → }/generators/rails/session_migration/session_migration_generator.rb
  213. 0 railties/lib/{rails → }/generators/rails/stylesheets/USAGE
  214. 0 railties/lib/{rails → }/generators/rails/stylesheets/stylesheets_generator.rb
  215. 0 railties/lib/{rails → }/generators/rails/stylesheets/templates/scaffold.css
  216. 0 railties/lib/{rails → }/generators/test_unit.rb
  217. +1 −1 railties/lib/{rails → }/generators/test_unit/controller/controller_generator.rb
  218. 0 railties/lib/{rails → }/generators/test_unit/controller/templates/functional_test.rb
  219. +1 −1 railties/lib/{rails → }/generators/test_unit/helper/helper_generator.rb
  220. 0 railties/lib/{rails → }/generators/test_unit/helper/templates/helper_test.rb
  221. +1 −1 railties/lib/{rails → }/generators/test_unit/integration/integration_generator.rb
  222. 0 railties/lib/{rails → }/generators/test_unit/integration/templates/integration_test.rb
  223. +2 −2 railties/lib/{rails → }/generators/test_unit/mailer/mailer_generator.rb
  224. 0 railties/lib/{rails → }/generators/test_unit/mailer/templates/fixture
  225. 0 ...st_unit/mailer/templates/unit_test.rb → generators/test_unit/mailer/templates/functional_test.rb}
  226. +1 −1 railties/lib/{rails → }/generators/test_unit/model/model_generator.rb
  227. 0 railties/lib/{rails → }/generators/test_unit/model/templates/fixtures.yml
  228. 0 railties/lib/{rails → }/generators/test_unit/model/templates/unit_test.rb
  229. +1 −1 railties/lib/{rails → }/generators/test_unit/observer/observer_generator.rb
  230. 0 railties/lib/{rails → }/generators/test_unit/observer/templates/unit_test.rb
  231. +1 −1 railties/lib/{rails → }/generators/test_unit/performance/performance_generator.rb
  232. 0 railties/lib/{rails → }/generators/test_unit/performance/templates/performance_test.rb
  233. +1 −1 railties/lib/{rails → }/generators/test_unit/plugin/plugin_generator.rb
  234. 0 railties/lib/{rails → }/generators/test_unit/plugin/templates/%file_name%_test.rb.tt
  235. 0 railties/lib/{rails → }/generators/test_unit/plugin/templates/test_helper.rb
  236. +1 −1 railties/lib/{rails → }/generators/test_unit/scaffold/scaffold_generator.rb
  237. 0 railties/lib/{rails → }/generators/test_unit/scaffold/templates/functional_test.rb
  238. +3 −2 railties/lib/rails.rb
  239. +12 −2 railties/lib/rails/application.rb
  240. +16 −15 railties/lib/rails/backtrace_cleaner.rb
  241. +8 −3 railties/lib/rails/bootstrap.rb
  242. +7 −16 railties/lib/rails/configuration.rb
  243. +3 −3 railties/lib/rails/deprecation.rb
  244. +93 −91 railties/lib/rails/generators.rb
  245. +6 −2 railties/lib/rails/generators/base.rb
  246. +5 −3 railties/lib/rails/generators/named_base.rb
  247. +7 −3 railties/lib/rails/generators/resource_helpers.rb
  248. +6 −2 railties/lib/rails/plugin.rb
  249. +3 −2 railties/lib/rails/rack.rb
  250. +26 −0 railties/lib/rails/rack/metal.rb
  251. +1 −1 railties/lib/rails/subscriber.rb
  252. +1 −1 railties/lib/rails/tasks/documentation.rake
  253. +4 −3 railties/lib/rails/tasks/framework.rake
  254. +6 −3 railties/lib/rails/vendor/thor-0.12.3/lib/thor/group.rb
  255. +2 −0 railties/test/application/middleware_test.rb
  256. +1 −1 railties/test/application/notifications_test.rb
  257. +2 −2 railties/test/backtrace_cleaner_test.rb
  258. +1 −1 railties/test/fixtures/lib/generators/active_record/{fixjour → }/fixjour_generator.rb
  259. +0 −4 railties/test/fixtures/lib/generators/rails/javascripts_generator.rb
  260. 0 railties/test/fixtures/{vendor/gems/gems/wrong → }/lib/generators/wrong_generator.rb
  261. +0 −2 railties/test/fixtures/vendor/another_gem_path/xspec/lib/generators/xspec_generator.rb
  262. +0 −2 railties/test/fixtures/vendor/plugins/mspec/lib/rails_generators/mspec_generator.rb
  263. +16 −2 railties/test/generators/actions_test.rb
  264. +8 −8 railties/test/generators/app_generator_test.rb
  265. +3 −2 railties/test/generators/controller_generator_test.rb
  266. +3 −2 railties/test/generators/generator_generator_test.rb
  267. +10 −12 railties/test/generators/generators_test_helper.rb
  268. +3 −2 railties/test/generators/helper_generator_test.rb
  269. +3 −2 railties/test/generators/integration_test_generator_test.rb
  270. +7 −6 railties/test/generators/mailer_generator_test.rb
  271. +3 −2 railties/test/generators/metal_generator_test.rb
  272. +4 −2 railties/test/generators/migration_generator_test.rb
  273. +3 −2 railties/test/generators/model_generator_test.rb
  274. +3 −2 railties/test/generators/named_base_test.rb
  275. +3 −2 railties/test/generators/observer_generator_test.rb
  276. +3 −2 railties/test/generators/performance_test_generator_test.rb
  277. +18 −2 railties/test/generators/plugin_generator_test.rb
  278. +3 −2 railties/test/generators/resource_generator_test.rb
  279. +3 −2 railties/test/generators/scaffold_controller_generator_test.rb
  280. +3 −2 railties/test/generators/scaffold_generator_test.rb
  281. +4 −2 railties/test/generators/session_migration_generator_test.rb
  282. +4 −2 railties/test/generators/stylesheets_generator_test.rb
  283. +61 −76 railties/test/generators_test.rb
  284. +3 −3 railties/test/subscriber_test.rb
@@ -23,8 +23,7 @@ module ActionMailer #:nodoc:
# bcc ["bcc@example.com", "Order Watcher <watcher@example.com>"]
# from "system@example.com"
# subject "New account information"
- #
- # @account = recipient
+ # body :account => recipient
# end
# end
#
@@ -144,12 +143,13 @@ module ActionMailer #:nodoc:
# subject "New account information"
# from "system@example.com"
# content_type "multipart/alternative"
+ # body :account => recipient
#
# part :content_type => "text/html",
- # :body => render_message("signup-as-html", :account => recipient)
+ # :data => render_message("signup-as-html")
#
# part "text/plain" do |p|
- # p.body = render_message("signup-as-plain", :account => recipient)
+ # p.body = render_message("signup-as-plain")
# p.content_transfer_encoding = "base64"
# end
# end
@@ -454,11 +454,13 @@ def matches_dynamic_method?(method_name) #:nodoc:
# body, headers, etc.) can be set on it.
def part(params)
params = {:content_type => params} if String === params
+
if custom_headers = params.delete(:headers)
ActiveSupport::Deprecation.warn('Passing custom headers with :headers => {} is deprecated. ' <<
'Please just pass in custom headers directly.', caller[0,10])
params.merge!(custom_headers)
end
+
part = Mail::Part.new(params)
yield part if block_given?
@parts << part
@@ -476,6 +478,20 @@ def attachment(params, &block)
part(params, &block)
end
+ # Allow you to set assigns for your template:
+ #
+ # body :greetings => "Hi"
+ #
+ # Will make @greetings available in the template to be rendered.
+ def body(object=nil)
+ returning(super) do # Run deprecation hooks
+ if object.is_a?(Hash)
+ @assigns_set = true
+ object.each { |k, v| instance_variable_set(:"@#{k}", v) }
+ end
+ end
+ end
+
# Instantiate a new mailer object. If +method_name+ is not +nil+, the mailer
# will be initialized according to the named method. If not, the mailer will
# remain uninitialized (useful when you only need to invoke the "receive"
@@ -523,6 +539,23 @@ def deliver!(mail = @mail)
private
+ # Render a message but does not set it as mail body. Useful for rendering
+ # data for part and attachments.
+ #
+ # Examples:
+ #
+ # render_message "special_message"
+ # render_message :template => "special_message"
+ # render_message :inline => "<%= 'Hi!' %>"
+ def render_message(object)
+ case object
+ when String
+ render_to_body(:template => object)
+ else
+ render_to_body(object)
+ end
+ end
+
# Set up the default values for the various instance variables of this
# mailer. Subclasses may override this method to provide different
# defaults.
@@ -1,15 +1,13 @@
module ActionMailer
# TODO Remove this module all together in a next release. Ensure that super
- # hooks in ActionMailer::Base are removed as well.
+ # hooks and @assigns_set in ActionMailer::Base are removed as well.
module DeprecatedBody
- def self.included(base)
- base.class_eval do
- # Define the body of the message. This is either a Hash (in which case it
- # specifies the variables to pass to the template when it is rendered),
- # or a string, in which case it specifies the actual text of the message.
- adv_attr_accessor :body
- end
- end
+ extend ActionMailer::AdvAttrAccessor
+
+ # Define the body of the message. This is either a Hash (in which case it
+ # specifies the variables to pass to the template when it is rendered),
+ # or a string, in which case it specifies the actual text of the message.
+ adv_attr_accessor :body
def initialize_defaults(method_name)
@body ||= {}
@@ -18,32 +16,28 @@ def initialize_defaults(method_name)
def attachment(params, &block)
if params[:body]
ActiveSupport::Deprecation.warn('attachment :body => "string" is deprecated. To set the body of an attachment ' <<
- 'please use :data instead, like attachment :data => "string".', caller[0,10])
+ 'please use :data instead, like attachment :data => "string"', caller[0,10])
params[:data] = params.delete(:body)
end
end
def create_parts
- if String === @body
- ActiveSupport::Deprecation.warn('body is deprecated. To set the body with a text ' <<
- 'call render(:text => "body").', caller[0,10])
+ if String === @body && !defined?(@assigns_set)
+ ActiveSupport::Deprecation.warn('body(String) is deprecated. To set the body with a text ' <<
+ 'call render(:text => "body")', caller[0,10])
self.response_body = @body
- elsif @body.is_a?(Hash) && !@body.empty?
- ActiveSupport::Deprecation.warn('body is deprecated. To set assigns simply ' <<
- 'use instance variables', caller[0,10])
- @body.each { |k, v| instance_variable_set(:"@#{k}", v) }
+ elsif self.response_body
+ @body = self.response_body
end
end
def render(*args)
options = args.last.is_a?(Hash) ? args.last : {}
if options[:body]
- ActiveSupport::Deprecation.warn(':body is deprecated. To set assigns simply ' <<
- 'use instance variables', caller[0,1])
+ ActiveSupport::Deprecation.warn(':body in render deprecated. Please call body ' <<
+ 'with a hash instead', caller[0,1])
- options.delete(:body).each do |k, v|
- instance_variable_set(:"@#{k}", v)
- end
+ body options.delete(:body)
end
super
@@ -120,11 +120,11 @@ def multipart_with_mime_version(recipient)
content_type "multipart/alternative"
part "text/plain" do |p|
- p.body = "blah"
+ p.body = render_message(:text => "blah")
end
part "text/html" do |p|
- p.body = "<b>blah</b>"
+ p.body = render_message(:inline => "<%= content_tag(:b, 'blah') %>")
end
end
@@ -301,7 +301,6 @@ def return_path
render :text => "testing"
end
- # This tests body calls accepeting a hash, which is deprecated.
def body_ivar(recipient)
recipients recipient
subject "Body as a local variable"
@@ -1078,7 +1077,7 @@ def test_return_path_with_create
def test_return_path_with_create
mail = TestMailer.create_return_path
- assert_equal "another@somewhere.test", mail.return_path
+ assert_equal ["another@somewhere.test"], mail.return_path
end
def test_return_path_with_deliver
@@ -1089,8 +1088,7 @@ def test_return_path_with_deliver
end
def test_body_is_stored_as_an_ivar
- mail = nil
- ActiveSupport::Deprecation.silence { mail = TestMailer.create_body_ivar(@recipient) }
+ mail = TestMailer.create_body_ivar(@recipient)
assert_equal "body: foo\nbar: baz", mail.body.to_s
end
@@ -62,15 +62,19 @@ def hidden_actions
# Array[String]:: A list of all methods that should be considered
# actions.
def action_methods
- @action_methods ||=
+ @action_methods ||= begin
# All public instance methods of this class, including ancestors
- public_instance_methods(true).map { |m| m.to_s }.to_set -
- # Except for public instance methods of Base and its ancestors
- internal_methods.map { |m| m.to_s } +
- # Be sure to include shadowed public instance methods of this class
- public_instance_methods(false).map { |m| m.to_s } -
- # And always exclude explicitly hidden actions
- hidden_actions
+ methods = public_instance_methods(true).map { |m| m.to_s }.to_set -
+ # Except for public instance methods of Base and its ancestors
+ internal_methods.map { |m| m.to_s } +
+ # Be sure to include shadowed public instance methods of this class
+ public_instance_methods(false).map { |m| m.to_s } -
+ # And always exclude explicitly hidden actions
+ hidden_actions
+
+ # Clear out AS callback method pollution
+ methods.reject { |method| method =~ /_one_time_conditions/ }
+ end
end
# Returns the full controller name, underscored, without the ending Controller.
@@ -116,68 +120,72 @@ def controller_path
self.class.controller_path
end
- private
- # Returns true if the name can be considered an action. This can
- # be overridden in subclasses to modify the semantics of what
- # can be considered an action.
- #
- # ==== Parameters
- # name<String>:: The name of an action to be tested
- #
- # ==== Returns
- # TrueClass, FalseClass
- def action_method?(name)
- self.class.action_methods.include?(name)
+ def action_methods
+ self.class.action_methods
end
- # Call the action. Override this in a subclass to modify the
- # behavior around processing an action. This, and not #process,
- # is the intended way to override action dispatching.
- def process_action(method_name, *args)
- send_action(method_name, *args)
- end
+ private
+ # Returns true if the name can be considered an action. This can
+ # be overridden in subclasses to modify the semantics of what
+ # can be considered an action.
+ #
+ # ==== Parameters
+ # name<String>:: The name of an action to be tested
+ #
+ # ==== Returns
+ # TrueClass, FalseClass
+ def action_method?(name)
+ self.class.action_methods.include?(name)
+ end
- # Actually call the method associated with the action. Override
- # this method if you wish to change how action methods are called,
- # not to add additional behavior around it. For example, you would
- # override #send_action if you want to inject arguments into the
- # method.
- alias send_action send
-
- # If the action name was not found, but a method called "action_missing"
- # was found, #method_for_action will return "_handle_action_missing".
- # This method calls #action_missing with the current action name.
- def _handle_action_missing
- action_missing(@_action_name)
- end
+ # Call the action. Override this in a subclass to modify the
+ # behavior around processing an action. This, and not #process,
+ # is the intended way to override action dispatching.
+ def process_action(method_name, *args)
+ send_action(method_name, *args)
+ end
- # Takes an action name and returns the name of the method that will
- # handle the action. In normal cases, this method returns the same
- # name as it receives. By default, if #method_for_action receives
- # a name that is not an action, it will look for an #action_missing
- # method and return "_handle_action_missing" if one is found.
- #
- # Subclasses may override this method to add additional conditions
- # that should be considered an action. For instance, an HTTP controller
- # with a template matching the action name is considered to exist.
- #
- # If you override this method to handle additional cases, you may
- # also provide a method (like _handle_method_missing) to handle
- # the case.
- #
- # If none of these conditions are true, and method_for_action
- # returns nil, an ActionNotFound exception will be raised.
- #
- # ==== Parameters
- # action_name<String>:: An action name to find a method name for
- #
- # ==== Returns
- # String:: The name of the method that handles the action
- # nil:: No method name could be found. Raise ActionNotFound.
- def method_for_action(action_name)
- if action_method?(action_name) then action_name
- elsif respond_to?(:action_missing, true) then "_handle_action_missing"
+ # Actually call the method associated with the action. Override
+ # this method if you wish to change how action methods are called,
+ # not to add additional behavior around it. For example, you would
+ # override #send_action if you want to inject arguments into the
+ # method.
+ alias send_action send
+
+ # If the action name was not found, but a method called "action_missing"
+ # was found, #method_for_action will return "_handle_action_missing".
+ # This method calls #action_missing with the current action name.
+ def _handle_action_missing
+ action_missing(@_action_name)
+ end
+
+ # Takes an action name and returns the name of the method that will
+ # handle the action. In normal cases, this method returns the same
+ # name as it receives. By default, if #method_for_action receives
+ # a name that is not an action, it will look for an #action_missing
+ # method and return "_handle_action_missing" if one is found.
+ #
+ # Subclasses may override this method to add additional conditions
+ # that should be considered an action. For instance, an HTTP controller
+ # with a template matching the action name is considered to exist.
+ #
+ # If you override this method to handle additional cases, you may
+ # also provide a method (like _handle_method_missing) to handle
+ # the case.
+ #
+ # If none of these conditions are true, and method_for_action
+ # returns nil, an ActionNotFound exception will be raised.
+ #
+ # ==== Parameters
+ # action_name<String>:: An action name to find a method name for
+ #
+ # ==== Returns
+ # String:: The name of the method that handles the action
+ # nil:: No method name could be found. Raise ActionNotFound.
+ def method_for_action(action_name)
+ if action_method?(action_name) then action_name
+ elsif respond_to?(:action_missing, true) then "_handle_action_missing"
+ end
end
- end
end
end
@@ -1,8 +1,5 @@
module ActionController
class Dispatcher
- cattr_accessor :prepare_each_request
- self.prepare_each_request = false
-
class << self
def before_dispatch(*args, &block)
ActiveSupport::Deprecation.warn "ActionController::Dispatcher.before_dispatch is deprecated. " <<
@@ -18,7 +15,7 @@ def after_dispatch(*args, &block)
def to_prepare(*args, &block)
ActiveSupport::Deprecation.warn "ActionController::Dispatcher.to_prepare is deprecated. " <<
- "Please use ActionDispatch::Callbacks.to_prepare instead.", caller
+ "Please use config.to_prepare instead", caller
ActionDispatch::Callbacks.after(*args, &block)
end
Oops, something went wrong.

0 comments on commit c71120e

Please sign in to comment.