Permalink
Browse files

Merge branch 'master' of git://github.com/rails/rails

  • Loading branch information...
2 parents cefe723 + 073852d commit f5774e3e3f70a3acfa559b9ff889e9417fb71d4b @mikel mikel committed Mar 11, 2010
Showing with 2,910 additions and 2,800 deletions.
  1. +1 −0 Gemfile
  2. +1 −0 RAILS_VERSION
  3. +7 −9 Rakefile
  4. +3 −4 actionmailer/actionmailer.gemspec
  5. +1 −0 actionmailer/lib/action_mailer.rb
  6. +8 −10 actionmailer/lib/action_mailer/base.rb
  7. +1 −1 actionmailer/lib/action_mailer/old_api.rb
  8. +1 −1 actionmailer/lib/action_mailer/quoting.rb
  9. +6 −4 actionmailer/lib/action_mailer/railtie.rb
  10. +5 −1 actionmailer/test/log_subscriber_test.rb
  11. +6 −3 actionmailer/test/old_base/asset_host_test.rb
  12. +4 −0 actionmailer/test/old_base/url_test.rb
  13. +5 −6 actionpack/actionpack.gemspec
  14. +2 −2 actionpack/lib/abstract_controller.rb
  15. +12 −4 actionpack/lib/abstract_controller/base.rb
  16. +0 −18 actionpack/lib/abstract_controller/compatibility.rb
  17. +0 −48 actionpack/lib/abstract_controller/details_cache.rb
  18. +36 −95 actionpack/lib/abstract_controller/layouts.rb
  19. +57 −155 actionpack/lib/abstract_controller/rendering.rb
  20. +73 −0 actionpack/lib/abstract_controller/view_paths.rb
  21. +1 −2 actionpack/lib/action_controller.rb
  22. +5 −24 actionpack/lib/action_controller/base.rb
  23. +19 −18 actionpack/lib/action_controller/caching.rb
  24. +24 −24 actionpack/lib/action_controller/caching/pages.rb
  25. +1 −3 actionpack/lib/action_controller/caching/sweeping.rb
  26. +131 −0 actionpack/lib/action_controller/deprecated/base.rb
  27. +10 −25 actionpack/lib/action_controller/metal.rb
  28. +18 −78 actionpack/lib/action_controller/metal/compatibility.rb
  29. +0 −28 actionpack/lib/action_controller/metal/configuration.rb
  30. +17 −33 actionpack/lib/action_controller/metal/http_authentication.rb
  31. +21 −0 actionpack/lib/action_controller/metal/implicit_render.rb
  32. +1 −1 actionpack/lib/action_controller/metal/instrumentation.rb
  33. +1 −4 actionpack/lib/action_controller/metal/rack_delegation.rb
  34. +18 −29 actionpack/lib/action_controller/metal/rendering.rb
  35. +41 −4 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  36. +0 −36 actionpack/lib/action_controller/metal/session_management.rb
  37. +1 −2 actionpack/lib/action_controller/metal/url_for.rb
  38. +2 −1 actionpack/lib/action_controller/middleware.rb
  39. +43 −7 actionpack/lib/action_controller/railtie.rb
  40. +14 −5 actionpack/lib/action_controller/test_case.rb
  41. +0 −98 actionpack/lib/action_controller/url_rewriter.rb
  42. +1 −0 actionpack/lib/action_dispatch.rb
  43. +0 −15 actionpack/lib/action_dispatch/http/mime_negotiation.rb
  44. +9 −30 actionpack/lib/action_dispatch/http/request.rb
  45. +3 −34 actionpack/lib/action_dispatch/http/url.rb
  46. +0 −1 actionpack/lib/action_dispatch/middleware/params_parser.rb
  47. +51 −0 actionpack/lib/action_dispatch/middleware/remote_ip.rb
  48. +5 −8 actionpack/lib/action_dispatch/middleware/session/cookie_store.rb
  49. +6 −2 actionpack/lib/action_dispatch/middleware/stack.rb
  50. +1 −0 actionpack/lib/action_dispatch/railtie.rb
  51. +32 −5 actionpack/lib/action_dispatch/routing/mapper.rb
  52. +2 −2 actionpack/lib/action_dispatch/routing/route.rb
  53. +173 −123 actionpack/lib/action_dispatch/routing/route_set.rb
  54. +20 −44 actionpack/lib/action_dispatch/routing/url_for.rb
  55. +9 −6 actionpack/lib/action_view.rb
  56. +26 −85 actionpack/lib/action_view/base.rb
  57. +1 −0 actionpack/lib/action_view/helpers.rb
  58. +5 −3 actionpack/lib/action_view/helpers/active_model_helper.rb
  59. +3 −10 actionpack/lib/action_view/helpers/asset_tag_helper.rb
  60. +1 −1 actionpack/lib/action_view/helpers/atom_feed_helper.rb
  61. +5 −9 actionpack/lib/action_view/helpers/capture_helper.rb
  62. +2 −1 actionpack/lib/action_view/helpers/date_helper.rb
  63. +52 −0 actionpack/lib/action_view/helpers/deprecated_block_helpers.rb
  64. +21 −10 actionpack/lib/action_view/helpers/form_helper.rb
  65. +2 −0 actionpack/lib/action_view/helpers/form_options_helper.rb
  66. +13 −7 actionpack/lib/action_view/helpers/form_tag_helper.rb
  67. +1 −7 actionpack/lib/action_view/helpers/javascript_helper.rb
  68. +42 −44 actionpack/lib/action_view/helpers/number_helper.rb
  69. +2 −2 actionpack/lib/action_view/helpers/prototype_helper.rb
  70. +4 −22 actionpack/lib/action_view/helpers/tag_helper.rb
  71. +3 −2 actionpack/lib/action_view/helpers/url_helper.rb
  72. +151 −0 actionpack/lib/action_view/lookup_context.rb
  73. +22 −63 actionpack/lib/action_view/paths.rb
  74. +3 −1 actionpack/lib/action_view/railtie.rb
  75. +65 −0 actionpack/lib/action_view/render/layouts.rb
  76. +10 −38 actionpack/lib/action_view/render/partials.rb
  77. +44 −71 actionpack/lib/action_view/render/rendering.rb
  78. +16 −16 actionpack/lib/action_view/template.rb
  79. +49 −5 actionpack/lib/action_view/template/handlers/erb.rb
  80. +50 −86 actionpack/lib/action_view/template/resolver.rb
  81. +4 −9 actionpack/lib/action_view/template/text.rb
  82. +7 −0 actionpack/lib/action_view/test_case.rb
  83. +2 −2 actionpack/test/abstract/abstract_controller_test.rb
  84. +0 −57 actionpack/test/abstract/details_cache_test.rb
  85. +85 −33 actionpack/test/abstract/layouts_test.rb
  86. +1 −60 actionpack/test/abstract/render_test.rb
  87. +16 −3 actionpack/test/abstract_unit.rb
  88. +27 −23 actionpack/test/controller/base_test.rb
  89. +19 −15 actionpack/test/controller/caching_test.rb
  90. +0 −12 actionpack/test/controller/content_type_test.rb
  91. +1 −1 actionpack/test/controller/cookie_test.rb
  92. +11 −7 actionpack/test/controller/http_digest_authentication_test.rb
  93. +4 −9 actionpack/test/controller/integration_test.rb
  94. +1 −2 actionpack/test/controller/log_subscriber_test.rb
  95. +0 −4 actionpack/test/controller/mime_responds_test.rb
  96. +3 −3 actionpack/test/controller/render_test.rb
  97. +5 −3 actionpack/test/controller/test_test.rb
  98. +4 −11 actionpack/test/controller/url_for_test.rb
  99. +14 −31 actionpack/test/controller/url_rewriter_test.rb
  100. +3 −0 actionpack/test/controller/view_paths_test.rb
  101. +36 −0 actionpack/test/dispatch/mount_test.rb
  102. +36 −121 actionpack/test/dispatch/request_test.rb
  103. +14 −0 actionpack/test/dispatch/routing_test.rb
  104. +38 −0 actionpack/test/dispatch/url_generation_test.rb
  105. +2 −0 actionpack/test/fixtures/test/layout_render_file.erb
  106. +7 −5 actionpack/test/lib/fixture_template.rb
  107. +33 −58 actionpack/test/template/asset_tag_helper_test.rb
  108. +1 −4 actionpack/test/template/compiled_templates_test.rb
  109. +62 −7 actionpack/test/template/date_helper_test.rb
  110. +82 −0 actionpack/test/template/erb/tag_helper_test.rb
  111. +74 −70 actionpack/test/template/form_helper_test.rb
  112. +11 −11 actionpack/test/template/form_options_helper_test.rb
  113. +10 −17 actionpack/test/template/form_tag_helper_test.rb
  114. +2 −14 actionpack/test/template/javascript_helper_test.rb
  115. +2 −2 actionpack/test/template/prototype_helper_test.rb
  116. +12 −7 actionpack/test/template/render_test.rb
  117. +7 −9 actionpack/test/template/tag_helper_test.rb
  118. +23 −10 actionpack/test/template/test_case_test.rb
  119. +34 −28 actionpack/test/template/url_helper_test.rb
  120. +3 −4 activemodel/activemodel.gemspec
  121. +5 −6 activerecord/activerecord.gemspec
  122. +8 −5 activerecord/lib/active_record.rb
  123. +20 −36 activerecord/lib/active_record/associations.rb
  124. +9 −170 activerecord/lib/active_record/base.rb
  125. +165 −0 activerecord/lib/active_record/errors.rb
  126. +1 −1 activerecord/lib/active_record/named_scope.rb
  127. +27 −15 activerecord/lib/active_record/railtie.rb
  128. +4 −0 activerecord/lib/active_record/relation.rb
  129. +1 −1 activerecord/lib/active_record/relation/predicate_builder.rb
  130. +13 −13 activerecord/lib/active_record/relation/query_methods.rb
  131. +2 −6 activerecord/lib/active_record/relation/spawn_methods.rb
  132. +26 −6 activerecord/test/cases/associations/belongs_to_associations_test.rb
  133. +1 −19 activerecord/test/cases/associations/has_many_associations_test.rb
  134. +2 −2 activerecord/test/cases/associations/has_one_associations_test.rb
  135. +2 −2 activerecord/test/cases/calculations_test.rb
  136. +1 −0 activerecord/test/cases/helper.rb
  137. +2 −1 activerecord/test/cases/log_subscriber_test.rb
  138. +3 −6 activerecord/test/models/author.rb
  139. +2 −2 activerecord/test/models/company.rb
  140. +4 −5 activeresource/activeresource.gemspec
  141. +3 −2 activeresource/test/cases/log_subscriber_test.rb
  142. +3 −4 activesupport/activesupport.gemspec
  143. +3 −0 activesupport/lib/active_support.rb
  144. +0 −1 activesupport/lib/active_support/all.rb
  145. +0 −1 activesupport/lib/active_support/core_ext/array/conversions.rb
  146. +23 −2 activesupport/lib/active_support/core_ext/class/attribute.rb
  147. +3 −1 activesupport/lib/active_support/core_ext/string/inflections.rb
  148. +1 −91 activesupport/lib/active_support/core_ext/string/interpolation.rb
  149. +5 −0 activesupport/lib/active_support/dependencies/autoload.rb
  150. +2 −1 activesupport/lib/active_support/deprecation/reporting.rb
  151. +2 −1 activesupport/lib/active_support/i18n.rb
  152. +1 −1 activesupport/lib/active_support/inflector/transliterate.rb
  153. +1 −1 activesupport/lib/active_support/json/decoding.rb
  154. +25 −0 activesupport/lib/active_support/lazy_load_hooks.rb
  155. +6 −0 activesupport/lib/active_support/ordered_options.rb
  156. +5 −3 activesupport/lib/active_support/railtie.rb
  157. +3 −4 activesupport/lib/active_support/whiny_nil.rb
  158. +25 −10 activesupport/test/core_ext/class/attribute_test.rb
  159. +6 −3 activesupport/test/inflector_test_cases.rb
  160. +2 −0 activesupport/test/whiny_nil_test.rb
  161. +1 −1 ci/ci_build.rb
  162. +9 −9 rails.gemspec
  163. +1 −1 railties/guides/source/configuring.textile
  164. +1 −1 railties/guides/source/security.textile
  165. +1 −1 railties/lib/generators/erb/scaffold/templates/_form.html.erb
  166. +1 −0 railties/lib/generators/erb/scaffold/templates/layout.html.erb
  167. +4 −4 railties/lib/generators/rails/app/templates/Gemfile
  168. +1 −1 railties/lib/generators/rails/app/templates/config/initializers/cookie_verification_secret.rb.tt
  169. +3 −8 railties/lib/generators/rails/app/templates/config/initializers/session_store.rb.tt
  170. +4 −0 railties/lib/generators/rails/stylesheets/templates/scaffold.css
  171. +4 −5 railties/lib/rails/application.rb
  172. +4 −0 railties/lib/rails/application/configuration.rb
  173. +1 −1 railties/lib/rails/application/routes_reloader.rb
  174. +0 −89 railties/lib/rails/configuration.rb
  175. +2 −2 railties/lib/rails/console/app.rb
  176. +3 −1 railties/lib/rails/console/helpers.rb
  177. +4 −4 railties/lib/rails/engine.rb
  178. +7 −2 railties/lib/rails/engine/configuration.rb
  179. +1 −0 railties/lib/rails/log_subscriber.rb
  180. +1 −1 railties/lib/rails/rack/logger.rb
  181. +117 −1 railties/lib/rails/railtie/configuration.rb
  182. +41 −31 railties/lib/rails/tasks/documentation.rake
  183. +1 −4 railties/lib/rails/test_help.rb
  184. +4 −5 railties/railties.gemspec
  185. +4 −2 railties/test/application/configuration_test.rb
  186. +2 −2 railties/test/application/initializers/frameworks_test.rb
  187. +2 −2 railties/test/application/metal_test.rb
  188. +54 −0 railties/test/application/middleware_stack_defaults_test.rb
  189. +1 −0 railties/test/application/middleware_test.rb
  190. +6 −5 railties/test/application/paths_test.rb
  191. +2 −1 railties/test/application/url_generation_test.rb
  192. +1 −1 railties/test/isolation/abstract_unit.rb
  193. +7 −5 railties/test/railties/shared_tests.rb
View
@@ -1,6 +1,7 @@
path File.dirname(__FILE__)
source 'http://rubygems.org'
+gem "arel", :git => "git://github.com/rails/arel.git"
gem "rails", "3.0.0.beta1"
gem "rake", ">= 0.8.7"
View
@@ -0,0 +1 @@
+3.0.0.beta1
View
@@ -3,15 +3,6 @@ require 'rake/rdoctask'
require 'rake/gempackagetask'
PROJECTS = %w(activesupport activemodel actionpack actionmailer activeresource activerecord railties)
-PROJECTS.each { |project| $:.unshift "#{project}/lib" }
-
-require "active_support/version"
-require "active_model/version"
-require "action_pack/version"
-require "action_mailer/version"
-require "active_resource/version"
-require "active_record/version"
-require "rails/version"
desc 'Run all tests by default'
task :default => %w(test test:isolated)
@@ -58,6 +49,7 @@ end
desc "Install gems for all projects."
task :install => :gem do
+ require File.expand_path("../actionpack/lib/action_pack/version", __FILE__)
(PROJECTS - ["railties"]).each do |project|
puts "INSTALLING #{project}"
system("gem install #{project}/pkg/#{project}-#{ActionPack::VERSION::STRING}.gem --no-ri --no-rdoc")
@@ -130,6 +122,12 @@ task :pdoc => :rdoc do
end
task :update_versions do
+ require File.dirname(__FILE__) + "/version"
+
+ File.open("RAILS_VERSION", "w") do |f|
+ f.write Rails::VERSION::STRING + "\n"
+ end
+
constants = {
"activesupport" => "ActiveSupport",
"activemodel" => "ActiveModel",
@@ -1,10 +1,9 @@
-$:.unshift "lib"
-require "action_mailer/version"
+version = File.read(File.expand_path("../../RAILS_VERSION", __FILE__)).strip
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'actionmailer'
- s.version = ActionMailer::VERSION::STRING
+ s.version = version
s.summary = 'Email composition, delivery, and receiving framework (part of Rails).'
s.description = 'Email on Rails. Compose, deliver, receive, and test emails using the familiar controller/view pattern. First-class support for multipart email and attachments.'
s.required_ruby_version = '>= 1.8.7'
@@ -20,7 +19,7 @@ Gem::Specification.new do |s|
s.has_rdoc = true
- s.add_dependency('actionpack', "= #{ActionMailer::VERSION::STRING}")
+ s.add_dependency('actionpack', version)
s.add_dependency('mail', '~> 2.1.3')
s.add_dependency('text-format', '~> 1.0.0')
end
@@ -34,6 +34,7 @@
require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/string/inflections'
+require 'active_support/lazy_load_hooks'
module ActionMailer
extend ::ActiveSupport::Autoload
@@ -267,11 +267,9 @@ class Base < AbstractController::Base
include AbstractController::Logger
include AbstractController::Rendering
- include AbstractController::DetailsCache
include AbstractController::Layouts
include AbstractController::Helpers
include AbstractController::Translation
- include AbstractController::Compatibility
helper ActionMailer::MailHelper
@@ -291,6 +289,8 @@ class Base < AbstractController::Base
:parts_order => [ "text/plain", "text/enriched", "text/html" ]
}.freeze
+ ActionMailer.run_base_hooks(self)
+
class << self
def mailer_name
@@ -616,14 +616,12 @@ def collect_responses_and_parts_order(headers) #:nodoc:
def each_template(paths, name, &block) #:nodoc:
Array(paths).each do |path|
- self.class.view_paths.each do |load_paths|
- templates = load_paths.find_all(name, {}, path)
- templates = templates.uniq_by { |t| t.details[:formats] }
-
- unless templates.empty?
- templates.each(&block)
- return
- end
+ templates = lookup_context.find_all(name, path)
+ templates = templates.uniq_by { |t| t.formats }
+
+ unless templates.empty?
+ templates.each(&block)
+ return
end
end
end
@@ -206,7 +206,7 @@ def create_parts
if String === @body
@parts.unshift create_inline_part(@body)
elsif @parts.empty? || @parts.all? { |p| p.content_disposition =~ /^attachment/ }
- self.class.view_paths.first.find_all(@template, {}, @mailer_name).each do |template|
+ lookup_context.find_all(@template, @mailer_name).each do |template|
@parts << create_inline_part(render(:_template => template), template.mime_type)
end
@@ -22,7 +22,7 @@ def quoted_printable_encode(character)
# A quick-and-dirty regexp for determining whether a string contains any
# characters that need escaping.
if !defined?(CHARS_NEEDING_QUOTING)
- CHARS_NEEDING_QUOTING = /[\000-\011\013\014\016-\037\177-\377]/
+ CHARS_NEEDING_QUOTING = Regexp.new('[\000-\011\013\014\016-\037\177-\377]', nil, 'n')
end
# Quote the given text if it contains any "illegal" characters
@@ -6,19 +6,21 @@ class Railtie < Rails::Railtie
railtie_name :action_mailer
initializer "action_mailer.url_for", :before => :load_environment_config do |app|
- ActionMailer::Base.send(:include, app.routes.url_helpers)
+ ActionMailer.base_hook { include app.routes.url_helpers }
end
require "action_mailer/railties/log_subscriber"
log_subscriber ActionMailer::Railties::LogSubscriber.new
initializer "action_mailer.logger" do
- ActionMailer::Base.logger ||= Rails.logger
+ ActionMailer.base_hook { self.logger ||= Rails.logger }
end
initializer "action_mailer.set_configs" do |app|
- app.config.action_mailer.each do |k,v|
- ActionMailer::Base.send "#{k}=", v
+ ActionMailer.base_hook do
+ app.config.action_mailer.each do |k,v|
+ send "#{k}=", v
+ end
end
end
end
@@ -4,7 +4,11 @@
class AMLogSubscriberTest < ActionMailer::TestCase
include Rails::LogSubscriber::TestHelper
- Rails::LogSubscriber.add(:action_mailer, ActionMailer::Railties::LogSubscriber.new)
+
+ def setup
+ super
+ Rails::LogSubscriber.add(:action_mailer, ActionMailer::Railties::LogSubscriber.new)
+ end
class TestMailer < ActionMailer::Base
def basic
@@ -14,20 +14,23 @@ def setup
set_delivery_method :test
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.deliveries.clear
+ AssetHostMailer.configure do |c|
+ c.asset_host = "http://www.example.com"
+ c.assets_dir = ''
+ end
end
def teardown
restore_delivery_method
end
def test_asset_host_as_string
- ActionController::Base.asset_host = "http://www.example.com"
mail = AssetHostMailer.email_with_asset
assert_equal "<img alt=\"Somelogo\" src=\"http://www.example.com/images/somelogo.png\" />", mail.body.to_s.strip
end
def test_asset_host_as_one_arguement_proc
- ActionController::Base.asset_host = Proc.new { |source|
+ AssetHostMailer.config.asset_host = Proc.new { |source|
if source.starts_with?('/images')
"http://images.example.com"
else
@@ -39,7 +42,7 @@ def test_asset_host_as_one_arguement_proc
end
def test_asset_host_as_two_arguement_proc
- ActionController::Base.asset_host = Proc.new {|source,request|
+ ActionController::Base.config.asset_host = Proc.new {|source,request|
if request && request.ssl?
"https://www.example.com"
else
@@ -13,6 +13,10 @@ class ActionMailer::Base
class TestMailer < ActionMailer::Base
default_url_options[:host] = 'www.basecamphq.com'
+ configure do |c|
+ c.assets_dir = '' # To get the tests to pass
+ end
+
def signed_up_with_url(recipient)
@recipients = recipient
@subject = "[Signed up] Welcome #{recipient}"
@@ -1,10 +1,9 @@
-$:.unshift "lib"
-require "action_pack/version"
+version = File.read(File.expand_path("../../RAILS_VERSION", __FILE__)).strip
Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.name = 'actionpack'
- s.version = ActionPack::VERSION::STRING
+ s.version = version
s.summary = 'Web-flow and rendering framework putting the VC in MVC (part of Rails).'
s.description = 'Web apps on Rails. Simple, battle-tested conventions for building and testing MVC web applications. Works with any Rack-compatible server.'
s.required_ruby_version = '>= 1.8.7'
@@ -20,10 +19,10 @@ Gem::Specification.new do |s|
s.has_rdoc = true
- s.add_dependency('activesupport', "= #{ActionPack::VERSION::STRING}")
- s.add_dependency('activemodel', "= #{ActionPack::VERSION::STRING}")
+ s.add_dependency('activesupport', version)
+ s.add_dependency('activemodel', version)
s.add_dependency('rack', '~> 1.1.0')
s.add_dependency('rack-test', '~> 0.5.0')
- s.add_dependency('rack-mount', '~> 0.5.1')
+ s.add_dependency('rack-mount', '~> 0.6.0')
s.add_dependency('erubis', '~> 2.6.5')
end
@@ -7,18 +7,18 @@
require 'active_support/core_ext/module/attr_internal'
require 'active_support/core_ext/module/delegation'
require 'active_support/core_ext/module/anonymous'
+require 'active_support/i18n'
module AbstractController
extend ActiveSupport::Autoload
autoload :Base
autoload :Callbacks
autoload :Collector
- autoload :Compatibility
- autoload :DetailsCache
autoload :Helpers
autoload :Layouts
autoload :Logger
autoload :Rendering
autoload :Translation
+ autoload :ViewPaths
end
@@ -1,11 +1,12 @@
+require 'active_support/ordered_options'
+
module AbstractController
class Error < StandardError; end
class ActionNotFound < StandardError; end
class Base
attr_internal :response_body
attr_internal :action_name
- attr_internal :formats
class << self
attr_reader :abstract
@@ -28,6 +29,14 @@ def descendants
@descendants ||= []
end
+ def config
+ @config ||= ActiveSupport::InheritableOptions.new(superclass < Base ? superclass.config : {})
+ end
+
+ def configure
+ yield config
+ end
+
# 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
@@ -90,9 +99,8 @@ def controller_path
abstract!
- # Initialize controller with nil formats.
- def initialize #:nodoc:
- @_formats = nil
+ def config
+ @config ||= ActiveSupport::InheritableOptions.new(self.class.config)
end
# Calls the action going through the entire action dispatch stack.
@@ -1,18 +0,0 @@
-module AbstractController
- module Compatibility
- extend ActiveSupport::Concern
-
- def _find_layout(name, details)
- details[:prefix] = nil if name =~ /\blayouts/
- super
- end
-
- # Move this into a "don't run in production" module
- def _default_layout(details, require_layout = false)
- super
- rescue ActionView::MissingTemplate
- _find_layout(_layout({}), {})
- nil
- end
- end
-end
@@ -1,48 +0,0 @@
-module AbstractController
- class HashKey
- @hash_keys = Hash.new {|h,k| h[k] = {} }
-
- def self.get(klass, details)
- @hash_keys[klass][details] ||= new(klass, details)
- end
-
- attr_reader :hash
- alias_method :eql?, :equal?
-
- def initialize(klass, details)
- @details, @hash = details, details.hash
- end
-
- def inspect
- "#<HashKey -- details: #{@details.inspect}>"
- end
- end
-
- module DetailsCache
- extend ActiveSupport::Concern
-
- module ClassMethods
- def clear_template_caches!
- ActionView::Partials::PartialRenderer::TEMPLATES.clear
- template_cache.clear
- super
- end
-
- def template_cache
- @template_cache ||= Hash.new {|h,k| h[k] = {} }
- end
- end
-
- def render_to_body(*args)
- Thread.current[:format_locale_key] = HashKey.get(self.class, details_for_render)
- super
- end
-
- private
-
- def with_template_cache(name, details)
- self.class.template_cache[HashKey.get(self.class, details)][name] ||= super
- end
-
- end
-end
Oops, something went wrong. Retry.

0 comments on commit f5774e3

Please sign in to comment.