Permalink
Browse files

Merge remote branch 'rails/master' into identity_map

Conflicts:
	activerecord/lib/active_record/associations/association_proxy.rb
	activerecord/lib/active_record/autosave_association.rb
	activerecord/lib/active_record/base.rb
	activerecord/lib/active_record/persistence.rb
  • Loading branch information...
2 parents 2ba06b4 + 0cbfd6c commit 02fc6fbccdd3345e95592cc14e7855e2f1ea14b3 @miloops miloops committed Dec 20, 2010
Showing with 6,147 additions and 3,115 deletions.
  1. +2 −1 Gemfile
  2. +1 −1 Rakefile
  3. +1 −1 actionmailer/Rakefile
  4. +6 −4 actionmailer/lib/action_mailer/base.rb
  5. +2 −2 actionmailer/lib/action_mailer/railtie.rb
  6. +5 −2 actionmailer/lib/action_mailer/test_case.rb
  7. +6 −0 actionpack/CHANGELOG
  8. +1 −1 actionpack/Rakefile
  9. +1 −1 actionpack/actionpack.gemspec
  10. +3 −4 actionpack/lib/abstract_controller/base.rb
  11. +3 −6 actionpack/lib/abstract_controller/layouts.rb
  12. +1 −1 actionpack/lib/abstract_controller/rendering.rb
  13. +41 −27 actionpack/lib/action_controller/caching/actions.rb
  14. +13 −7 actionpack/lib/action_controller/caching/pages.rb
  15. +4 −4 actionpack/lib/action_controller/metal/mime_responds.rb
  16. +11 −27 actionpack/lib/action_controller/metal/renderers.rb
  17. +23 −24 actionpack/lib/action_controller/metal/rendering.rb
  18. +7 −3 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  19. +3 −1 actionpack/lib/action_controller/metal/url_for.rb
  20. +2 −2 actionpack/lib/action_controller/railtie.rb
  21. +8 −0 actionpack/lib/action_controller/railties/paths.rb
  22. +4 −2 actionpack/lib/action_controller/test_case.rb
  23. +2 −2 actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
  24. +1 −0 actionpack/lib/action_dispatch.rb
  25. +4 −2 actionpack/lib/action_dispatch/http/mime_negotiation.rb
  26. +45 −5 actionpack/lib/action_dispatch/http/mime_type.rb
  27. +90 −19 actionpack/lib/action_dispatch/http/url.rb
  28. +6 −25 actionpack/lib/action_dispatch/middleware/callbacks.rb
  29. +15 −5 actionpack/lib/action_dispatch/middleware/cookies.rb
  30. +65 −0 actionpack/lib/action_dispatch/middleware/reloader.rb
  31. +121 −104 actionpack/lib/action_dispatch/routing/mapper.rb
  32. +3 −5 actionpack/lib/action_dispatch/routing/polymorphic_routes.rb
  33. +110 −0 actionpack/lib/action_dispatch/routing/redirection.rb
  34. +23 −31 actionpack/lib/action_dispatch/routing/route_set.rb
  35. +7 −0 actionpack/lib/action_dispatch/routing/url_for.rb
  36. +5 −3 actionpack/lib/action_dispatch/testing/integration.rb
  37. +10 −2 actionpack/lib/action_view/base.rb
  38. +0 −1 actionpack/lib/action_view/helpers/asset_tag_helpers/asset_include_tag.rb
  39. +3 −3 actionpack/lib/action_view/helpers/form_helper.rb
  40. +6 −2 actionpack/lib/action_view/helpers/form_tag_helper.rb
  41. +3 −2 actionpack/lib/action_view/helpers/number_helper.rb
  42. +25 −7 actionpack/lib/action_view/helpers/translation_helper.rb
  43. +1 −1 actionpack/lib/action_view/lookup_context.rb
  44. +5 −0 actionpack/lib/action_view/partials.rb
  45. +2 −4 actionpack/lib/action_view/path_set.rb
  46. +9 −1 actionpack/lib/action_view/railtie.rb
  47. +1 −1 actionpack/lib/action_view/renderer/template_renderer.rb
  48. +6 −1 actionpack/lib/action_view/template.rb
  49. +7 −1 actionpack/lib/action_view/template/handlers.rb
  50. +10 −5 actionpack/lib/action_view/template/resolver.rb
  51. +0 −8 actionpack/test/abstract_unit.rb
  52. +12 −0 actionpack/test/activerecord/active_record_store_test.rb
  53. +3 −3 actionpack/test/activerecord/render_partial_with_record_identification_test.rb
  54. +16 −0 actionpack/test/controller/caching_test.rb
  55. +74 −2 actionpack/test/controller/mime_responds_test.rb
  56. +10 −10 actionpack/test/controller/new_base/render_template_test.rb
  57. +297 −284 actionpack/test/controller/routing_test.rb
  58. +22 −0 actionpack/test/controller/runner_test.rb
  59. +22 −1 actionpack/test/controller/url_for_test.rb
  60. +13 −59 actionpack/test/dispatch/callbacks_test.rb
  61. +21 −0 actionpack/test/dispatch/cookies_test.rb
  62. +49 −2 actionpack/test/dispatch/mime_type_test.rb
  63. +18 −0 actionpack/test/dispatch/mount_test.rb
  64. +124 −0 actionpack/test/dispatch/reloader_test.rb
  65. +36 −3 actionpack/test/dispatch/request_test.rb
  66. +76 −0 actionpack/test/dispatch/routing_test.rb
  67. +1 −0 actionpack/test/fixtures/star_star_mime/index.js.erb
  68. +0 −1 actionpack/test/fixtures/test/scoped_translation.erb
  69. +0 −1 actionpack/test/fixtures/test/translation.erb
  70. +1 −0 actionpack/test/fixtures/translations/templates/array.erb
  71. +1 −0 actionpack/test/fixtures/translations/templates/found.erb
  72. +1 −0 actionpack/test/fixtures/translations/templates/missing.erb
  73. +6 −0 actionpack/test/lib/controller/fake_models.rb
  74. +27 −2 actionpack/test/template/lookup_context_test.rb
  75. +5 −0 actionpack/test/template/number_helper_test.rb
  76. +5 −0 actionpack/test/template/render_test.rb
  77. +45 −27 actionpack/test/template/translation_helper_test.rb
  78. +4 −1 activemodel/CHANGELOG
  79. 0 activemodel/Rakefile
  80. +3 −1 activemodel/activemodel.gemspec
  81. +1 −0 activemodel/lib/active_model.rb
  82. +2 −2 activemodel/lib/active_model/attribute_methods.rb
  83. +0 −1 activemodel/lib/active_model/dirty.rb
  84. +7 −1 activemodel/lib/active_model/errors.rb
  85. +14 −14 activemodel/lib/active_model/lint.rb
  86. +58 −0 activemodel/lib/active_model/secure_password.rb
  87. +1 −0 activemodel/lib/active_model/serializers/xml.rb
  88. +11 −1 activemodel/lib/active_model/validations.rb
  89. +1 −1 activemodel/lib/active_model/validations/numericality.rb
  90. +7 −1 activemodel/lib/active_model/validations/validates.rb
  91. +5 −0 activemodel/test/cases/errors_test.rb
  92. +0 −6 activemodel/test/cases/helper.rb
  93. +32 −0 activemodel/test/cases/secure_password_test.rb
  94. +8 −7 activemodel/test/cases/serializeration/json_serialization_test.rb
  95. +17 −0 activemodel/test/cases/translation_test.rb
  96. +8 −0 activemodel/test/cases/validations/validates_test.rb
  97. +11 −3 activemodel/test/cases/validations_test.rb
  98. +8 −0 activemodel/test/models/user.rb
  99. +6 −0 activemodel/test/validators/namespace/email_validator.rb
  100. +55 −0 activerecord/CHANGELOG
  101. +1 −1 activerecord/Rakefile
  102. +3 −2 activerecord/lib/active_record/association_preload.rb
  103. +49 −580 activerecord/lib/active_record/associations.rb
  104. +27 −28 activerecord/lib/active_record/associations/association_collection.rb
  105. +1 −1 activerecord/lib/active_record/associations/association_proxy.rb
  106. +1 −1 activerecord/lib/active_record/associations/belongs_to_association.rb
  107. +232 −0 activerecord/lib/active_record/associations/class_methods/join_dependency.rb
  108. +274 −0 activerecord/lib/active_record/associations/class_methods/join_dependency/join_association.rb
  109. +26 −0 activerecord/lib/active_record/associations/class_methods/join_dependency/join_base.rb
  110. +80 −0 activerecord/lib/active_record/associations/class_methods/join_dependency/join_part.rb
  111. +11 −9 activerecord/lib/active_record/associations/has_and_belongs_to_many_association.rb
  112. +5 −9 activerecord/lib/active_record/associations/has_many_association.rb
  113. +4 −4 activerecord/lib/active_record/associations/has_many_through_association.rb
  114. +1 −1 activerecord/lib/active_record/associations/has_one_association.rb
  115. +2 −2 activerecord/lib/active_record/associations/has_one_through_association.rb
  116. +50 −43 activerecord/lib/active_record/associations/through_association_scope.rb
  117. +1 −1 activerecord/lib/active_record/attribute_methods.rb
  118. +9 −8 activerecord/lib/active_record/attribute_methods/before_type_cast.rb
  119. +2 −1 activerecord/lib/active_record/attribute_methods/dirty.rb
  120. +2 −1 activerecord/lib/active_record/attribute_methods/read.rb
  121. +4 −2 activerecord/lib/active_record/attribute_methods/time_zone_conversion.rb
  122. +10 −12 activerecord/lib/active_record/autosave_association.rb
  123. +83 −68 activerecord/lib/active_record/base.rb
  124. +1 −0 activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rb
  125. +2 −2 activerecord/lib/active_record/connection_adapters/abstract/database_limits.rb
  126. +5 −3 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  127. +1 −7 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  128. +7 −6 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  129. +1 −2 activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb
  130. +2 −1 activerecord/lib/active_record/counter_cache.rb
  131. +9 −9 activerecord/lib/active_record/locking/optimistic.rb
  132. +43 −26 activerecord/lib/active_record/migration.rb
  133. +6 −4 activerecord/lib/active_record/named_scope.rb
  134. +13 −13 activerecord/lib/active_record/nested_attributes.rb
  135. +7 −33 activerecord/lib/active_record/observer.rb
  136. +8 −6 activerecord/lib/active_record/persistence.rb
  137. +4 −6 activerecord/lib/active_record/railtie.rb
  138. +35 −29 activerecord/lib/active_record/railties/databases.rake
  139. +15 −13 activerecord/lib/active_record/reflection.rb
  140. +35 −20 activerecord/lib/active_record/relation.rb
  141. +1 −1 activerecord/lib/active_record/relation/calculations.rb
  142. +4 −13 activerecord/lib/active_record/relation/finder_methods.rb
  143. +1 −1 activerecord/lib/active_record/relation/predicate_builder.rb
  144. +88 −55 activerecord/lib/active_record/relation/query_methods.rb
  145. +4 −3 activerecord/lib/active_record/relation/spawn_methods.rb
  146. +3 −3 activerecord/lib/active_record/schema.rb
  147. +10 −10 activerecord/lib/active_record/serializers/xml_serializer.rb
  148. +4 −4 activerecord/lib/active_record/session_store.rb
  149. +5 −3 activerecord/lib/active_record/timestamp.rb
  150. +19 −15 activerecord/lib/active_record/transactions.rb
  151. +1 −1 activerecord/lib/active_record/validations.rb
  152. +2 −5 activerecord/lib/active_record/validations/uniqueness.rb
  153. +4 −0 activerecord/lib/rails/generators/active_record/model/templates/migration.rb
  154. +37 −0 activerecord/test/cases/associations/belongs_to_associations_test.rb
  155. +29 −9 activerecord/test/cases/associations/eager_test.rb
  156. +1 −2 activerecord/test/cases/associations/has_many_associations_test.rb
  157. +25 −2 activerecord/test/cases/associations/has_many_through_associations_test.rb
  158. +3 −4 activerecord/test/cases/associations/has_one_associations_test.rb
  159. +26 −1 activerecord/test/cases/associations/has_one_through_associations_test.rb
  160. +4 −4 activerecord/test/cases/associations/inner_join_association_test.rb
  161. +0 −2 activerecord/test/cases/associations/inverse_associations_test.rb
  162. +17 −11 activerecord/test/cases/associations/join_model_test.rb
  163. +4 −4 activerecord/test/cases/associations_test.rb
  164. +9 −0 activerecord/test/cases/attribute_methods_test.rb
  165. +15 −4 activerecord/test/cases/autosave_association_test.rb
  166. +54 −41 activerecord/test/cases/base_test.rb
  167. +33 −0 activerecord/test/cases/clone_test.rb
  168. +2 −2 activerecord/test/cases/connection_pool_test.rb
  169. +4 −4 activerecord/test/cases/dirty_test.rb
  170. +103 −0 activerecord/test/cases/dup_test.rb
  171. +0 −5 activerecord/test/cases/helper.rb
  172. +1 −1 activerecord/test/cases/inheritance_test.rb
  173. +16 −0 activerecord/test/cases/lifecycle_test.rb
  174. +1 −0 activerecord/test/cases/locking_test.rb
  175. +43 −53 activerecord/test/cases/migration_test.rb
  176. +21 −21 activerecord/test/cases/named_scope_test.rb
  177. +13 −1 activerecord/test/cases/nested_attributes_test.rb
  178. +6 −1 activerecord/test/cases/reflection_test.rb
  179. +17 −1 activerecord/test/cases/relation_scoping_test.rb
  180. +139 −0 activerecord/test/cases/relation_test.rb
  181. +15 −4 activerecord/test/cases/relations_test.rb
  182. +8 −8 activerecord/test/cases/transactions_test.rb
  183. +27 −0 activerecord/test/cases/xml_serialization_test.rb
  184. +9 −0 activerecord/test/cases/yaml_serialization_test.rb
  185. +2 −2 ...rations/interleaved/{pass_2/3_innocent_jointable.rb → pass_1/3_interleaved_innocent_jointable.rb}
  186. +2 −2 ...interleaved/{pass_3/1_people_have_last_names.rb → pass_2/1_interleaved_people_have_last_names.rb}
  187. +2 −2 ...rations/interleaved/{pass_3/3_innocent_jointable.rb → pass_2/3_interleaved_innocent_jointable.rb}
  188. +2 −2 .../{valid/1_people_have_last_names.rb → interleaved/pass_3/1_interleaved_people_have_last_names.rb}
  189. +0 −8 activerecord/test/migrations/interleaved/pass_3/2_i_raise_on_down.rb
  190. +8 −0 activerecord/test/migrations/interleaved/pass_3/2_interleaved_i_raise_on_down.rb
  191. +2 −2 ...rations/interleaved/{pass_1/3_innocent_jointable.rb → pass_3/3_interleaved_innocent_jointable.rb}
  192. +2 −2 ...th_timestamps/20100101010101_people_have_last_names.rb → valid/1_valid_people_have_last_names.rb}
  193. +2 −2 ..._names.rb → valid_with_timestamps/20100101010101_valid_with_timestamps_people_have_last_names.rb}
  194. +2 −2 ...{20100201010101_we_need_reminders.rb → 20100201010101_valid_with_timestamps_we_need_reminders.rb}
  195. +2 −2 ...0100301010101_innocent_jointable.rb → 20100301010101_valid_with_timestamps_innocent_jointable.rb}
  196. +8 −0 activerecord/test/models/author.rb
  197. +13 −1 activerecord/test/models/categorization.rb
  198. +1 −1 activerecord/test/models/contract.rb
  199. +1 −0 activerecord/test/models/person.rb
  200. +12 −0 activerecord/test/models/pet.rb
  201. +17 −0 activerecord/test/models/post.rb
  202. +1 −0 activerecord/test/schema/schema.rb
  203. +1 −1 activeresource/Rakefile
  204. +5 −3 activeresource/lib/active_resource/base.rb
  205. 0 activesupport/Rakefile
  206. +3 −3 activesupport/lib/active_support/cache.rb
  207. +45 −47 activesupport/lib/active_support/callbacks.rb
  208. +12 −0 activesupport/lib/active_support/configurable.rb
  209. +9 −0 activesupport/lib/active_support/core_ext/class/inheritable_attributes.rb
  210. +1 −0 activesupport/lib/active_support/core_ext/module/synchronization.rb
  211. +0 −5 activesupport/lib/active_support/core_ext/object/try.rb
  212. +12 −10 activesupport/lib/active_support/core_ext/string/output_safety.rb
  213. +1 −1 activesupport/lib/active_support/dependencies.rb
  214. +1 −1 activesupport/lib/active_support/file_update_checker.rb
  215. +3 −4 activesupport/lib/active_support/hash_with_indifferent_access.rb
  216. +0 −1 activesupport/lib/active_support/i18n.rb
  217. +1 −1 activesupport/lib/active_support/i18n_railtie.rb
  218. +5 −0 activesupport/test/core_ext/class/class_inheritable_attributes_test.rb
  219. +8 −0 activesupport/test/core_ext/hash_ext_test.rb
  220. +1 −0 activesupport/test/core_ext/module/synchronization_test.rb
  221. +1 −1 railties/Rakefile
  222. +2 −2 railties/guides/source/3_0_release_notes.textile
  223. +0 −2 railties/guides/source/action_controller_overview.textile
  224. +6 −8 railties/guides/source/action_mailer_basics.textile
  225. +9 −55 railties/guides/source/active_record_querying.textile
  226. +13 −13 railties/guides/source/active_record_validations_callbacks.textile
  227. +49 −0 railties/guides/source/active_support_core_extensions.textile
  228. +4 −0 railties/guides/source/association_basics.textile
  229. +20 −24 railties/guides/source/command_line.textile
  230. +335 −67 railties/guides/source/configuring.textile
  231. +7 −2 railties/guides/source/contributing_to_rails.textile
  232. +6 −6 railties/guides/source/debugging_rails_applications.textile
  233. +263 −8 railties/guides/source/generators.textile
  234. +3 −1 railties/guides/source/getting_started.textile
  235. +37 −37 railties/guides/source/i18n.textile
  236. +393 −121 railties/guides/source/initialization.textile
  237. +10 −14 railties/guides/source/layouts_and_rendering.textile
  238. +1 −1 railties/guides/source/migrations.textile
  239. +1 −1 railties/guides/source/performance_testing.textile
  240. +76 −76 railties/guides/source/routing.textile
  241. +4 −4 railties/guides/source/security.textile
  242. +17 −11 railties/guides/source/testing.textile
  243. +6 −1 railties/lib/rails/application.rb
  244. +3 −5 railties/lib/rails/application/bootstrap.rb
  245. +3 −16 railties/lib/rails/application/configuration.rb
  246. +6 −2 railties/lib/rails/application/finisher.rb
  247. +0 −8 railties/lib/rails/application/railties.rb
  248. +1 −2 railties/lib/rails/commands.rb
  249. +2 −2 railties/lib/rails/console/app.rb
  250. +16 −4 railties/lib/rails/engine.rb
  251. +10 −0 railties/lib/rails/engine/railties.rb
  252. +1 −0 railties/lib/rails/generators.rb
  253. +1 −1 railties/lib/rails/generators/actions.rb
  254. +7 −1 railties/lib/rails/generators/app_base.rb
  255. +1 −1 railties/lib/rails/generators/migration.rb
  256. +1 −1 railties/lib/rails/generators/named_base.rb
  257. +8 −12 railties/lib/rails/generators/rails/app/app_generator.rb
  258. +1 −1 railties/lib/rails/generators/rails/app/templates/Rakefile
  259. +1 −1 railties/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt
  260. +3 −10 railties/lib/rails/generators/rails/app/templates/config/boot.rb
  261. +407 −326 railties/lib/rails/generators/rails/app/templates/public/javascripts/prototype.js
  262. +2 −2 railties/lib/rails/generators/rails/generator/generator_generator.rb
  263. +1 −1 railties/lib/rails/generators/rails/plugin/templates/Rakefile.tt
  264. +40 −1 railties/lib/rails/generators/rails/plugin_new/plugin_new_generator.rb
  265. +6 −3 railties/lib/rails/generators/rails/plugin_new/templates/Rakefile
  266. +1 −1 railties/lib/rails/generators/rails/plugin_new/templates/lib/%name%/engine.rb
  267. +2 −0 railties/lib/rails/generators/rails/plugin_new/templates/test/integration/navigation_test.rb
  268. +0 −5 railties/lib/rails/generators/rails/plugin_new/templates/test/test_helper.rb
  269. +2 −2 railties/lib/rails/railtie.rb
  270. +4 −6 railties/lib/rails/railtie/configurable.rb
  271. +69 −0 railties/lib/rails/tasks/engine.rake
  272. +0 −11 railties/lib/rails/test_help.rb
  273. +43 −0 railties/test/application/configuration_test.rb
  274. +4 −4 railties/test/application/console_test.rb
  275. +7 −0 railties/test/application/middleware_test.rb
  276. +6 −0 railties/test/generators/app_generator_test.rb
  277. +39 −0 railties/test/generators/generator_generator_test.rb
  278. +15 −3 railties/test/generators/model_generator_test.rb
  279. +31 −1 railties/test/generators/plugin_new_generator_test.rb
  280. +5 −2 railties/test/generators/scaffold_generator_test.rb
  281. +9 −0 railties/test/generators/shared_generator_tests.rb
  282. +159 −69 railties/test/railties/engine_test.rb
  283. +3 −3 railties/test/railties/railtie_test.rb
View
@@ -1,13 +1,14 @@
source 'http://rubygems.org'
+gemspec
+
if ENV['AREL']
gem "arel", :path => ENV['AREL']
else
gem "arel", :git => "git://github.com/rails/arel.git"
end
gem "rack", :git => "git://github.com/rack/rack.git"
-gem "rails", :path => File.dirname(__FILE__)
gem "rake", ">= 0.8.7"
gem "mocha", ">= 0.9.8"
View
2 Rakefile 100644 → 100755
@@ -1,7 +1,7 @@
+#!/usr/bin/env rake
gem 'rdoc', '>= 2.5.10'
require 'rdoc'
-require 'rake'
require 'rdoc/task'
require 'net/http'
View
2 actionmailer/Rakefile 100644 → 100755
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
@@ -234,8 +234,8 @@ module ActionMailer #:nodoc:
# default :sender => 'system@example.com'
# end
#
- # You can pass in any header value that a <tt>Mail::Message</tt>, out of the box, <tt>ActionMailer::Base</tt>
- # sets the following:
+ # You can pass in any header value that a <tt>Mail::Message</tt> accepts. Out of the box,
+ # <tt>ActionMailer::Base</tt> sets the following:
#
# * <tt>:mime_version => "1.0"</tt>
# * <tt>:charset => "UTF-8",</tt>
@@ -273,7 +273,7 @@ module ActionMailer #:nodoc:
# = Configuration options
#
# These options are specified on the class level, like
- # <tt>ActionMailer::Base.template_root = "/my/templates"</tt>
+ # <tt>ActionMailer::Base.raise_delivery_errors = true</tt>
#
# * <tt>default</tt> - You can pass this in at a class level as well as within the class itself as
# per the above section.
@@ -290,7 +290,9 @@ 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>.
+ # This is a symbol and one of <tt>:plain</tt> (will send the password in the clear), <tt>:login</tt> (will
+ # send password BASE64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
+ # information and a cryptographic Message Digest 5 algorithm to hash important information)
# * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server
# and starts to use it.
#
@@ -19,8 +19,8 @@ class Railtie < Rails::Railtie
options.stylesheets_dir ||= paths["public/stylesheets"].first
# make sure readers methods get compiled
- options.asset_path ||= nil
- options.asset_host ||= nil
+ options.asset_path ||= app.config.asset_path
+ options.asset_host ||= app.config.asset_host
ActiveSupport.on_load(:action_mailer) do
include AbstractController::UrlFor
@@ -1,3 +1,5 @@
+require 'active_support/core_ext/class/attribute'
+
module ActionMailer
class NonInferrableMailerError < ::StandardError
def initialize(name)
@@ -15,11 +17,11 @@ module Behavior
module ClassMethods
def tests(mailer)
- write_inheritable_attribute(:mailer_class, mailer)
+ self._mailer_class = mailer
end
def mailer_class
- if mailer = read_inheritable_attribute(:mailer_class)
+ if mailer = self._mailer_class
mailer
else
tests determine_default_mailer(name)
@@ -65,6 +67,7 @@ def read_fixture(action)
end
included do
+ class_attribute :_mailer_class
setup :initialize_test_deliveries
setup :set_expected_mail
end
View
@@ -1,5 +1,11 @@
*Rails 3.1.0 (unreleased)*
+* brought back config.action_view.cache_template_loading, which allows to decide whether templates should be cached or not [Piotr Sarnacki]
+
+* url_for and named url helpers now accept :subdomain and :domain as options [Josh Kalderimis]
+
+* The redirect route method now also accepts a hash of options which will only change the parts of the url in question, or an object which responds to call, allowing for redirects to be reused (check the documentation for examples). [Josh Kalderimis]
+
* Added config.action_controller.include_all_helpers. By default 'helper :all' is done in ActionController::Base, which includes all the helpers by default. Setting include_all_helpers to false will result in including only application_helper and helper corresponding to controller (like foo_helper for foo_controller). [Piotr Sarnacki]
* Added a convenience idiom to generate HTML5 data-* attributes in tag helpers from a :data hash of options:
View
2 actionpack/Rakefile 100644 → 100755
@@ -1,4 +1,4 @@
-require 'rake'
+#!/usr/bin/env rake
require 'rake/testtask'
require 'rake/packagetask'
require 'rake/gempackagetask'
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
s.add_dependency('activemodel', version)
s.add_dependency('rack-cache', '~> 0.5.3')
s.add_dependency('builder', '~> 3.0.0')
- s.add_dependency('i18n', '~> 0.4.2')
+ s.add_dependency('i18n', '~> 0.5.0')
s.add_dependency('rack', '~> 1.2.1')
s.add_dependency('rack-test', '~> 0.5.6')
s.add_dependency('rack-mount', '~> 0.6.13')
@@ -31,10 +31,9 @@ def abstract!
# A list of all internal methods for a controller. This finds the first
# abstract superclass of a controller, and gets a list of all public
# instance methods on that abstract class. Public instance methods of
- # a controller would normally be considered action methods, so we
- # are removing those methods on classes declared as abstract
- # (ActionController::Metal and ActionController::Base are defined
- # as abstract)
+ # a controller would normally be considered action methods, so methods
+ # declared on abstract classes are being removed.
+ # (ActionController::Metal and ActionController::Base are defined as abstract)
def internal_methods
controller = self
controller = controller.superclass until controller.abstract?
@@ -235,13 +235,10 @@ def _implied_layout_name
controller_path
end
- # Takes the specified layout and creates a _layout method to be called
- # by _default_layout
+ # Creates a _layout method to be called by _default_layout .
#
- # If there is no explicit layout specified:
- # If a layout is found in the view paths with the controller's
- # name, return that string. Otherwise, use the superclass'
- # layout (which might also be implied)
+ # If a layout is not explicitly mentioned then look for a layout with the controller's name.
+ # if nothing is found then try same procedure to find super class's layout.
def _write_layout_method
remove_possible_method(:_layout)
@@ -128,7 +128,7 @@ def view_assigns
hash = {}
variables = instance_variable_names
variables -= protected_instance_variables if respond_to?(:protected_instance_variables)
- variables.each { |name| hash[name.to_s[1..-1]] = instance_variable_get(name) }
+ variables.each { |name| hash[name.to_s[1, name.length]] = instance_variable_get(name) }
hash
end
@@ -4,25 +4,26 @@ module ActionController #:nodoc:
module Caching
# Action caching is similar to page caching by the fact that the entire
# output of the response is cached, but unlike page caching, every
- # request still goes through the Action Pack. The key benefit
- # of this is that filters are run before the cache is served, which
- # allows for authentication and other restrictions on whether someone
- # is allowed to see the cache. Example:
+ # request still goes through Action Pack. The key benefit of this is
+ # that filters run before the cache is served, which allows for
+ # authentication and other restrictions on whether someone is allowed
+ # to execute such action. Example:
#
# class ListsController < ApplicationController
# before_filter :authenticate, :except => :public
+ #
# caches_page :public
- # caches_action :index, :show, :feed
+ # caches_action :index, :show
# end
#
- # In this example, the public action doesn't require authentication,
- # so it's possible to use the faster page caching method. But both
- # the show and feed action are to be shielded behind the authenticate
- # filter, so we need to implement those as action caches.
+ # In this example, the +public+ action doesn't require authentication
+ # so it's possible to use the faster page caching. On the other hand
+ # +index+ and +show+ require authentication. They can still be cached,
+ # but we need action caching for them.
#
- # Action caching internally uses the fragment caching and an around
- # filter to do the job. The fragment cache is named according to both
- # the current host and the path. So a page that is accessed at
+ # Action caching uses fragment caching internally and an around
+ # filter to do the job. The fragment cache is named according to
+ # the host and path of the request. A page that is accessed at
# <tt>http://david.example.com/lists/show/1</tt> will result in a fragment named
# <tt>david.example.com/lists/show/1</tt>. This allows the cacher to
# differentiate between <tt>david.example.com/lists/</tt> and
@@ -38,39 +39,52 @@ module Caching
# <tt>:action => 'list', :format => :xml</tt>.
#
# You can set modify the default action cache path by passing a
- # :cache_path option. This will be passed directly to
- # ActionCachePath.path_for. This is handy for actions with multiple
- # possible routes that should be cached differently. If a block is
- # given, it is called with the current controller instance.
+ # <tt>:cache_path</tt> option. This will be passed directly to
+ # <tt>ActionCachePath.path_for</tt>. This is handy for actions with
+ # multiple possible routes that should be cached differently. If a
+ # block is given, it is called with the current controller instance.
+ #
+ # And you can also use <tt>:if</tt> (or <tt>:unless</tt>) to pass a
+ # proc that specifies when the action should be cached.
#
- # And you can also use :if (or :unless) to pass a Proc that
- # specifies when the action should be cached.
+ # Finally, if you are using memcached, you can also pass <tt>:expires_in</tt>.
#
- # Finally, if you are using memcached, you can also pass :expires_in.
+ # The following example depicts some of the points made above:
#
# class ListsController < ApplicationController
# before_filter :authenticate, :except => :public
- # caches_page :public
+ #
+ # caches_page :public
+ #
# caches_action :index, :if => proc do |c|
# !c.request.format.json? # cache if is not a JSON request
# end
#
# caches_action :show, :cache_path => { :project => 1 },
# :expires_in => 1.hour
#
- # caches_action :feed, :cache_path => proc do |controller|
- # if controller.params[:user_id]
- # controller.send(:user_list_url,
- # controller.params[:user_id], controller.params[:id])
+ # caches_action :feed, :cache_path => proc do |c|
+ # if c.params[:user_id]
+ # c.send(:user_list_url,
+ # c.params[:user_id], c.params[:id])
# else
- # controller.send(:list_url, controller.params[:id])
+ # c.send(:list_url, c.params[:id])
# end
# end
# end
#
- # If you pass :layout => false, it will only cache your action
- # content. It is useful when your layout has dynamic information.
+ # If you pass <tt>:layout => false</tt>, it will only cache your action
+ # content. That's useful when your layout has dynamic information.
+ #
+ # Warning: If the format of the request is determined by the Accept HTTP
+ # header the Content-Type of the cached response could be wrong because
+ # no information about the MIME type is stored in the cache key. So, if
+ # you first ask for MIME type M in the Accept header, a cache entry is
+ # created, and then perform a second resquest to the same resource asking
+ # for a different MIME type, you'd get the content cached for M.
#
+ # The <tt>:format</tt> parameter is taken into account though. The safest
+ # way to cache by MIME type is to pass the format in the route.
module Actions
extend ActiveSupport::Concern
@@ -70,9 +70,9 @@ def expire_page(path)
# Manually cache the +content+ in the key determined by +path+. Example:
# cache_page "I'm the cached content", "/lists/show"
- def cache_page(content, path)
+ def cache_page(content, path, extension = nil)
return unless perform_caching
- path = page_cache_path(path)
+ path = page_cache_path(path, extension)
instrument_page_cache :write_page, path do
FileUtils.makedirs(File.dirname(path))
@@ -97,14 +97,16 @@ def caches_page(*actions)
end
private
- def page_cache_file(path)
+ def page_cache_file(path, extension)
name = (path.empty? || path == "/") ? "/index" : URI.parser.unescape(path.chomp('/'))
- name << page_cache_extension unless (name.split('/').last || name).include? '.'
+ unless (name.split('/').last || name).include? '.'
+ name << (extension || self.page_cache_extension)
+ end
return name
end
- def page_cache_path(path)
- page_cache_directory + page_cache_file(path)
+ def page_cache_path(path, extension = nil)
+ page_cache_directory + page_cache_file(path, extension)
end
def instrument_page_cache(name, path)
@@ -145,7 +147,11 @@ def cache_page(content = nil, options = nil)
request.path
end
- self.class.cache_page(content || response.body, path)
+ if (type = Mime::LOOKUP[self.content_type]) && (type_symbol = type.symbol).present?
+ extension = ".#{type_symbol}"
+ end
+
+ self.class.cache_page(content || response.body, path, extension)
end
end
@@ -258,9 +258,8 @@ def collect_mimes_from_class_level #:nodoc:
# nil if :not_acceptable was sent to the client.
#
def retrieve_response_from_mimes(mimes=nil, &block)
- collector = Collector.new { default_render }
mimes ||= collect_mimes_from_class_level
- mimes.each { |mime| collector.send(mime) }
+ collector = Collector.new(mimes) { default_render }
block.call(collector) if block_given?
if format = request.negotiate_mime(collector.order)
@@ -277,8 +276,9 @@ class Collector #:nodoc:
include AbstractController::Collector
attr_accessor :order
- def initialize(&block)
+ def initialize(mimes, &block)
@order, @responses, @default_response = [], {}, block
+ mimes.each { |mime| send(mime) }
end
def any(*args, &block)
@@ -291,7 +291,7 @@ def any(*args, &block)
alias :all :any
def custom(mime_type, &block)
- mime_type = mime_type.is_a?(Mime::Type) ? mime_type : Mime::Type.lookup(mime_type.to_s)
+ mime_type = Mime::Type.lookup(mime_type.to_s) unless mime_type.is_a?(Mime::Type)
@order << mime_type
@responses[mime_type] ||= block
end
Oops, something went wrong.

0 comments on commit 02fc6fb

Please sign in to comment.