mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Merge
This commit is contained in:
commit
e7ef57dd0d
42 changed files with 353 additions and 384 deletions
2
Gemfile
2
Gemfile
|
@ -13,7 +13,7 @@ gem "pg", ">= 0.8.0"
|
|||
gem "mysql", ">= 2.8.1"
|
||||
|
||||
# AP
|
||||
gem "rack", "1.0.1", :git => "git://github.com/rails/rack.git"
|
||||
gem "rack", "1.1.0", :git => "git://github.com/rack/rack.git"
|
||||
gem "rack-test", "0.5.3"
|
||||
gem "RedCloth", ">= 4.2.2"
|
||||
|
||||
|
|
|
@ -41,18 +41,3 @@ module ActionMailer
|
|||
autoload :TestHelper
|
||||
autoload :Utils
|
||||
end
|
||||
|
||||
module Text
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Format, 'action_mailer/vendor/text_format'
|
||||
end
|
||||
|
||||
module Net
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :SMTP
|
||||
end
|
||||
|
||||
|
||||
require 'action_mailer/vendor/tmail'
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
require 'active_support/core_ext/class'
|
||||
require 'action_mailer/part'
|
||||
require 'action_mailer/vendor/text_format'
|
||||
require 'action_mailer/vendor/tmail'
|
||||
|
||||
module ActionMailer #:nodoc:
|
||||
# Action Mailer allows you to send email from your application using a mailer model and views.
|
||||
|
@ -250,31 +253,21 @@ module ActionMailer #:nodoc:
|
|||
# <tt>["text/html", "text/enriched", "text/plain"]</tt>. Items that appear first in the array have higher priority in the mail client
|
||||
# and appear last in the mime encoded message. You can also pick a different order from inside a method with
|
||||
# +implicit_parts_order+.
|
||||
class Base
|
||||
class Base < AbstractController::Base
|
||||
include AdvAttrAccessor, PartContainer, Quoting, Utils
|
||||
|
||||
include AbstractController::Rendering
|
||||
include AbstractController::LocalizedCache
|
||||
include AbstractController::Layouts
|
||||
|
||||
include AbstractController::Helpers
|
||||
|
||||
helper ActionMailer::MailHelper
|
||||
|
||||
if Object.const_defined?(:ActionController)
|
||||
include ActionController::UrlWriter
|
||||
end
|
||||
|
||||
include ActionController::UrlWriter
|
||||
include ActionMailer::DeprecatedBody
|
||||
|
||||
private_class_method :new #:nodoc:
|
||||
|
||||
class_inheritable_accessor :view_paths
|
||||
self.view_paths = []
|
||||
|
||||
attr_internal :formats
|
||||
|
||||
cattr_accessor :logger
|
||||
|
||||
@@raise_delivery_errors = true
|
||||
cattr_accessor :raise_delivery_errors
|
||||
|
||||
|
@ -346,24 +339,13 @@ module ActionMailer #:nodoc:
|
|||
# have multiple mailer methods share the same template.
|
||||
adv_attr_accessor :template
|
||||
|
||||
# The mail and action_name instances referenced by this mailer.
|
||||
attr_reader :mail, :action_name
|
||||
|
||||
# Where the response body is stored.
|
||||
attr_internal :response_body
|
||||
|
||||
# Override the mailer name, which defaults to an inflected version of the
|
||||
# mailer's class name. If you want to use a template in a non-standard
|
||||
# location, you can use this to specify that location.
|
||||
attr_writer :mailer_name
|
||||
adv_attr_accessor :mailer_name
|
||||
|
||||
def mailer_name(value = nil)
|
||||
if value
|
||||
@mailer_name = value
|
||||
else
|
||||
@mailer_name || self.class.mailer_name
|
||||
end
|
||||
end
|
||||
# Expose the internal mail
|
||||
attr_reader :mail
|
||||
|
||||
# Alias controller_path to mailer_name so render :partial in views work.
|
||||
alias :controller_path :mailer_name
|
||||
|
@ -453,18 +435,16 @@ module ActionMailer #:nodoc:
|
|||
# will be initialized according to the named method. If not, the mailer will
|
||||
# remain uninitialized (useful when you only need to invoke the "receive"
|
||||
# method, for instance).
|
||||
def initialize(method_name=nil, *parameters) #:nodoc:
|
||||
@_formats = []
|
||||
@_response_body = nil
|
||||
def initialize(method_name=nil, *args) #:nodoc:
|
||||
super()
|
||||
create!(method_name, *parameters) if method_name
|
||||
process(method_name, *args) if method_name
|
||||
end
|
||||
|
||||
# Initialize the mailer via the given +method_name+. The body will be
|
||||
# Process the mailer via the given +method_name+. The body will be
|
||||
# rendered and a new TMail::Mail object created.
|
||||
def create!(method_name, *parameters) #:nodoc:
|
||||
def process(method_name, *args) #:nodoc:
|
||||
initialize_defaults(method_name)
|
||||
__send__(method_name, *parameters)
|
||||
super
|
||||
|
||||
# Create e-mail parts
|
||||
create_parts
|
||||
|
@ -473,7 +453,7 @@ module ActionMailer #:nodoc:
|
|||
@subject ||= I18n.t(:subject, :scope => [:actionmailer, mailer_name, method_name],
|
||||
:default => method_name.humanize)
|
||||
|
||||
# build the mail object itself
|
||||
# Build the mail object itself
|
||||
@mail = create_mail
|
||||
end
|
||||
|
||||
|
@ -488,7 +468,7 @@ module ActionMailer #:nodoc:
|
|||
logger.debug "\n#{mail.encoded}"
|
||||
end
|
||||
|
||||
ActiveSupport::Notifications.instrument(:deliver_mail, :mail => @mail) do
|
||||
ActiveSupport::Notifications.instrument(:deliver_mail, :mail => mail) do
|
||||
begin
|
||||
self.delivery_method.perform_delivery(mail) if perform_deliveries
|
||||
rescue Exception => e # Net::SMTP errors or sendmail pipe errors
|
||||
|
@ -510,23 +490,18 @@ module ActionMailer #:nodoc:
|
|||
@implicit_parts_order ||= @@default_implicit_parts_order.dup
|
||||
@mime_version ||= @@default_mime_version.dup if @@default_mime_version
|
||||
|
||||
@mailer_name ||= self.class.mailer_name
|
||||
@mailer_name ||= self.class.mailer_name.dup
|
||||
@template ||= method_name
|
||||
@action_name = @template
|
||||
|
||||
@parts ||= []
|
||||
@headers ||= {}
|
||||
@sent_on ||= Time.now
|
||||
|
||||
ActiveSupport::Deprecation.silence do
|
||||
super # Run deprecation hooks
|
||||
end
|
||||
super # Run deprecation hooks
|
||||
end
|
||||
|
||||
def create_parts
|
||||
ActiveSupport::Deprecation.silence do
|
||||
super # Run deprecation hooks
|
||||
end
|
||||
super # Run deprecation hooks
|
||||
|
||||
if String === response_body
|
||||
@parts.unshift Part.new(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require "active_support/core_ext/class"
|
||||
require 'active_support/core_ext/class'
|
||||
|
||||
module ActionMailer
|
||||
module DeliveryMethod
|
||||
|
||||
autoload :File, 'action_mailer/delivery_method/file'
|
||||
autoload :Sendmail, 'action_mailer/delivery_method/sendmail'
|
||||
autoload :Smtp, 'action_mailer/delivery_method/smtp'
|
||||
|
@ -52,6 +52,5 @@ module ActionMailer
|
|||
superclass_delegating_accessor :settings
|
||||
self.settings = {}
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
require 'net/smtp'
|
||||
|
||||
module ActionMailer
|
||||
module DeliveryMethod
|
||||
# A delivery method implementation which sends via smtp.
|
||||
class Smtp < Method
|
||||
|
||||
self.settings = {
|
||||
:address => "localhost",
|
||||
:port => 25,
|
||||
|
@ -26,6 +27,5 @@ module ActionMailer
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,13 +34,13 @@ class TestMailer < ActionMailer::Base
|
|||
def from_with_name
|
||||
from "System <system@loudthinking.com>"
|
||||
recipients "root@loudthinking.com"
|
||||
body "Nothing to see here."
|
||||
render :text => "Nothing to see here."
|
||||
end
|
||||
|
||||
def from_without_name
|
||||
from "system@loudthinking.com"
|
||||
recipients "root@loudthinking.com"
|
||||
body "Nothing to see here."
|
||||
render :text => "Nothing to see here."
|
||||
end
|
||||
|
||||
def cc_bcc(recipient)
|
||||
|
@ -301,6 +301,7 @@ class TestMailer < ActionMailer::Base
|
|||
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"
|
||||
|
@ -1043,7 +1044,8 @@ EOF
|
|||
end
|
||||
|
||||
def test_body_is_stored_as_an_ivar
|
||||
mail = TestMailer.create_body_ivar(@recipient)
|
||||
mail = nil
|
||||
ActiveSupport::Deprecation.silence { mail = TestMailer.create_body_ivar(@recipient) }
|
||||
assert_equal "body: foo\nbar: baz", mail.body
|
||||
end
|
||||
|
||||
|
|
|
@ -12,8 +12,8 @@ class TestMailer < ActionMailer::Base
|
|||
@from = "system@loudthinking.com"
|
||||
@sent_on = Time.local(2004, 12, 12)
|
||||
|
||||
@body["recipient"] = recipient
|
||||
@body["welcome_url"] = url_for :host => "example.com", :controller => "welcome", :action => "greeting"
|
||||
@recipient = recipient
|
||||
@welcome_url = url_for :host => "example.com", :controller => "welcome", :action => "greeting"
|
||||
end
|
||||
|
||||
class <<self
|
||||
|
|
|
@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|||
|
||||
s.add_dependency('activesupport', '= 3.0.pre')
|
||||
s.add_dependency('activemodel', '= 3.0.pre')
|
||||
s.add_dependency('rack', '~> 1.0.1')
|
||||
s.add_dependency('rack', '~> 1.1.0')
|
||||
s.add_dependency('rack-test', '~> 0.5.0')
|
||||
s.add_dependency('rack-mount', '~> 0.3.2')
|
||||
s.add_dependency('erubis', '~> 2.6.5')
|
||||
|
|
|
@ -8,13 +8,11 @@ require 'active_support/core_ext/module/delegation'
|
|||
module AbstractController
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
deferrable do
|
||||
autoload :Base
|
||||
autoload :Callbacks
|
||||
autoload :Helpers
|
||||
autoload :Layouts
|
||||
autoload :LocalizedCache
|
||||
autoload :Logger
|
||||
autoload :Rendering
|
||||
end
|
||||
autoload :Base
|
||||
autoload :Callbacks
|
||||
autoload :Helpers
|
||||
autoload :Layouts
|
||||
autoload :LocalizedCache
|
||||
autoload :Logger
|
||||
autoload :Rendering
|
||||
end
|
||||
|
|
|
@ -84,7 +84,7 @@ module AbstractController
|
|||
#
|
||||
# ==== Returns
|
||||
# self
|
||||
def process(action)
|
||||
def process(action, *args)
|
||||
@_action_name = action_name = action.to_s
|
||||
|
||||
unless action_name = method_for_action(action_name)
|
||||
|
@ -93,7 +93,7 @@ module AbstractController
|
|||
|
||||
@_response_body = nil
|
||||
|
||||
process_action(action_name)
|
||||
process_action(action_name, *args)
|
||||
end
|
||||
|
||||
private
|
||||
|
@ -113,8 +113,8 @@ module AbstractController
|
|||
# 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)
|
||||
send_action(method_name)
|
||||
def process_action(method_name, *args)
|
||||
send_action(method_name, *args)
|
||||
end
|
||||
|
||||
# Actually call the method associated with the action. Override
|
||||
|
|
|
@ -29,33 +29,5 @@ module AbstractController
|
|||
@str.send(*args, &block)
|
||||
end
|
||||
end
|
||||
|
||||
# Override process_action in the AbstractController::Base
|
||||
# to log details about the method.
|
||||
def process_action(action)
|
||||
result = ActiveSupport::Notifications.instrument(:process_action,
|
||||
:controller => self, :action => action) do
|
||||
super
|
||||
end
|
||||
|
||||
if logger
|
||||
log = DelayedLog.new do
|
||||
"\n\nProcessing #{self.class.name}\##{action_name} " \
|
||||
"to #{request.formats} (for #{request_origin}) " \
|
||||
"[#{request.method.to_s.upcase}]"
|
||||
end
|
||||
|
||||
logger.info(log)
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
private
|
||||
# Returns the request origin with the IP and time. This needs to be cached,
|
||||
# otherwise we would get different results for each time it calls.
|
||||
def request_origin
|
||||
@request_origin ||= "#{request.remote_ip} at #{Time.now.to_s(:db)}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -5,65 +5,66 @@ require 'active_support/ruby/shim'
|
|||
module ActionController
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
deferrable do
|
||||
autoload :Base
|
||||
autoload :Caching
|
||||
autoload :PolymorphicRoutes
|
||||
autoload :Translation
|
||||
autoload :Metal
|
||||
autoload :Middleware
|
||||
autoload :Base
|
||||
autoload :Caching
|
||||
autoload :PolymorphicRoutes
|
||||
autoload :Translation
|
||||
autoload :Metal
|
||||
autoload :Middleware
|
||||
|
||||
autoload_under "metal" do
|
||||
autoload :Benchmarking
|
||||
autoload :ConditionalGet
|
||||
autoload :Configuration
|
||||
autoload :Head
|
||||
autoload :Helpers
|
||||
autoload :HideActions
|
||||
autoload :Layouts
|
||||
autoload :MimeResponds
|
||||
autoload :RackDelegation
|
||||
autoload :Compatibility
|
||||
autoload :Redirecting
|
||||
autoload :Rendering
|
||||
autoload :Renderers
|
||||
autoload :Rescue
|
||||
autoload :Responder
|
||||
autoload :SessionManagement
|
||||
autoload :UrlFor
|
||||
autoload :Verification
|
||||
autoload :Flash
|
||||
autoload :RequestForgeryProtection
|
||||
autoload :Streaming
|
||||
autoload :HttpAuthentication
|
||||
autoload :FilterParameterLogging
|
||||
autoload :Cookies
|
||||
end
|
||||
|
||||
autoload :Dispatcher, 'action_controller/dispatch/dispatcher'
|
||||
autoload :PerformanceTest, 'action_controller/deprecated/performance_test'
|
||||
autoload :Routing, 'action_controller/deprecated'
|
||||
autoload :Integration, 'action_controller/deprecated/integration_test'
|
||||
autoload :IntegrationTest, 'action_controller/deprecated/integration_test'
|
||||
autoload_under "metal" do
|
||||
autoload :Benchmarking
|
||||
autoload :ConditionalGet
|
||||
autoload :Configuration
|
||||
autoload :Head
|
||||
autoload :Helpers
|
||||
autoload :HideActions
|
||||
autoload :Layouts
|
||||
autoload :Logger
|
||||
autoload :MimeResponds
|
||||
autoload :RackDelegation
|
||||
autoload :Compatibility
|
||||
autoload :Redirecting
|
||||
autoload :Rendering
|
||||
autoload :Renderers
|
||||
autoload :Rescue
|
||||
autoload :Responder
|
||||
autoload :SessionManagement
|
||||
autoload :UrlFor
|
||||
autoload :Verification
|
||||
autoload :Flash
|
||||
autoload :RequestForgeryProtection
|
||||
autoload :Streaming
|
||||
autoload :HttpAuthentication
|
||||
autoload :FilterParameterLogging
|
||||
autoload :Cookies
|
||||
end
|
||||
|
||||
autoload :RecordIdentifier
|
||||
autoload :UrlRewriter
|
||||
autoload :UrlWriter, 'action_controller/url_rewriter'
|
||||
autoload :Dispatcher, 'action_controller/dispatch/dispatcher'
|
||||
autoload :PerformanceTest, 'action_controller/deprecated/performance_test'
|
||||
autoload :Routing, 'action_controller/deprecated'
|
||||
autoload :Integration, 'action_controller/deprecated/integration_test'
|
||||
autoload :IntegrationTest, 'action_controller/deprecated/integration_test'
|
||||
|
||||
# TODO: Don't autoload exceptions, setup explicit
|
||||
# requires for files that need them
|
||||
autoload_at "action_controller/metal/exceptions" do
|
||||
autoload :ActionControllerError
|
||||
autoload :RenderError
|
||||
autoload :RoutingError
|
||||
autoload :MethodNotAllowed
|
||||
autoload :NotImplemented
|
||||
autoload :UnknownController
|
||||
autoload :MissingFile
|
||||
autoload :RenderError
|
||||
autoload :SessionOverflowError
|
||||
autoload :UnknownHttpMethod
|
||||
eager_autoload do
|
||||
autoload :RecordIdentifier
|
||||
autoload :UrlRewriter
|
||||
autoload :UrlWriter, 'action_controller/url_rewriter'
|
||||
|
||||
# TODO: Don't autoload exceptions, setup explicit
|
||||
# requires for files that need them
|
||||
autoload_at "action_controller/metal/exceptions" do
|
||||
autoload :ActionControllerError
|
||||
autoload :RenderError
|
||||
autoload :RoutingError
|
||||
autoload :MethodNotAllowed
|
||||
autoload :NotImplemented
|
||||
autoload :UnknownController
|
||||
autoload :MissingFile
|
||||
autoload :RenderError
|
||||
autoload :SessionOverflowError
|
||||
autoload :UnknownHttpMethod
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ module ActionController
|
|||
include ActionController::Layouts
|
||||
include ActionController::ConditionalGet
|
||||
include ActionController::RackDelegation
|
||||
include ActionController::Logger
|
||||
include ActionController::Benchmarking
|
||||
include ActionController::Configuration
|
||||
|
||||
|
@ -89,7 +90,7 @@ module ActionController
|
|||
end
|
||||
|
||||
if options[:status]
|
||||
options[:status] = ActionDispatch::StatusCodes[options[:status]]
|
||||
options[:status] = Rack::Utils.status_code(options[:status])
|
||||
end
|
||||
|
||||
options[:update] = blk if block_given?
|
||||
|
|
|
@ -32,11 +32,13 @@ module ActionController #:nodoc:
|
|||
extend ActiveSupport::Concern
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Actions
|
||||
autoload :Fragments
|
||||
autoload :Pages
|
||||
autoload :Sweeper, 'action_controller/caching/sweeping'
|
||||
autoload :Sweeping, 'action_controller/caching/sweeping'
|
||||
eager_autoload do
|
||||
autoload :Actions
|
||||
autoload :Fragments
|
||||
autoload :Pages
|
||||
autoload :Sweeper, 'action_controller/caching/sweeping'
|
||||
autoload :Sweeping, 'action_controller/caching/sweeping'
|
||||
end
|
||||
|
||||
included do
|
||||
@@cache_store = nil
|
||||
|
|
|
@ -69,7 +69,7 @@ module ActionController
|
|||
end
|
||||
|
||||
def status=(status)
|
||||
@_status = ActionDispatch::StatusCodes[status]
|
||||
@_status = Rack::Utils.status_code(status)
|
||||
end
|
||||
|
||||
# :api: private
|
||||
|
|
|
@ -53,7 +53,6 @@ module ActionController #:nodoc:
|
|||
log_message << " [#{complete_request_uri rescue "unknown"}]"
|
||||
|
||||
logger.info(log_message)
|
||||
response.headers["X-Runtime"] = "%.0f" % ms
|
||||
else
|
||||
super
|
||||
end
|
||||
|
|
34
actionpack/lib/action_controller/metal/logger.rb
Normal file
34
actionpack/lib/action_controller/metal/logger.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
require 'abstract_controller/logger'
|
||||
|
||||
module ActionController
|
||||
module Logger
|
||||
# Override process_action in the AbstractController::Base
|
||||
# to log details about the method.
|
||||
def process_action(action)
|
||||
result = ActiveSupport::Notifications.instrument(:process_action,
|
||||
:controller => self, :action => action) do
|
||||
super
|
||||
end
|
||||
|
||||
if logger
|
||||
log = AbstractController::Logger::DelayedLog.new do
|
||||
"\n\nProcessing #{self.class.name}\##{action_name} " \
|
||||
"to #{request.formats} (for #{request_origin}) " \
|
||||
"[#{request.method.to_s.upcase}]"
|
||||
end
|
||||
|
||||
logger.info(log)
|
||||
end
|
||||
|
||||
result
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# Returns the request origin with the IP and time. This needs to be cached,
|
||||
# otherwise we would get different results for each time it calls.
|
||||
def request_origin
|
||||
@request_origin ||= "#{request.remote_ip} at #{Time.now.to_s(:db)}"
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,3 +1,6 @@
|
|||
require 'action_dispatch/http/request'
|
||||
require 'action_dispatch/http/response'
|
||||
|
||||
module ActionController
|
||||
module RackDelegation
|
||||
extend ActiveSupport::Concern
|
||||
|
|
|
@ -58,18 +58,18 @@ module ActionController
|
|||
|
||||
logger.info("Redirected to #{location}") if logger && logger.info?
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def _extract_redirect_to_status(options, response_status)
|
||||
status = if options.is_a?(Hash) && options.key?(:status)
|
||||
ActionDispatch::StatusCodes[options.delete(:status)]
|
||||
Rack::Utils.status_code(options.delete(:status))
|
||||
elsif response_status.key?(:status)
|
||||
ActionDispatch::StatusCodes[response_status[:status]]
|
||||
Rack::Utils.status_code(response_status[:status])
|
||||
else
|
||||
302
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def _compute_redirect_to_location(options)
|
||||
case options
|
||||
# The scheme name consist of a letter followed by any combination of
|
||||
|
|
|
@ -3,16 +3,18 @@ $LOAD_PATH << "#{File.dirname(__FILE__)}/html-scanner"
|
|||
module HTML
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :CDATA, 'html/node'
|
||||
autoload :Document, 'html/document'
|
||||
autoload :FullSanitizer, 'html/sanitizer'
|
||||
autoload :LinkSanitizer, 'html/sanitizer'
|
||||
autoload :Node, 'html/node'
|
||||
autoload :Sanitizer, 'html/sanitizer'
|
||||
autoload :Selector, 'html/selector'
|
||||
autoload :Tag, 'html/node'
|
||||
autoload :Text, 'html/node'
|
||||
autoload :Tokenizer, 'html/tokenizer'
|
||||
autoload :Version, 'html/version'
|
||||
autoload :WhiteListSanitizer, 'html/sanitizer'
|
||||
eager_autoload do
|
||||
autoload :CDATA, 'html/node'
|
||||
autoload :Document, 'html/document'
|
||||
autoload :FullSanitizer, 'html/sanitizer'
|
||||
autoload :LinkSanitizer, 'html/sanitizer'
|
||||
autoload :Node, 'html/node'
|
||||
autoload :Sanitizer, 'html/sanitizer'
|
||||
autoload :Selector, 'html/selector'
|
||||
autoload :Tag, 'html/node'
|
||||
autoload :Text, 'html/node'
|
||||
autoload :Tokenizer, 'html/tokenizer'
|
||||
autoload :Version, 'html/version'
|
||||
autoload :WhiteListSanitizer, 'html/sanitizer'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -37,43 +37,38 @@ module ActionDispatch
|
|||
autoload_under 'http' do
|
||||
autoload :Request
|
||||
autoload :Response
|
||||
autoload :StatusCodes
|
||||
end
|
||||
|
||||
deferrable do
|
||||
autoload_under 'middleware' do
|
||||
autoload :Callbacks
|
||||
autoload :ParamsParser
|
||||
autoload :Rescue
|
||||
autoload :ShowExceptions
|
||||
autoload :Static
|
||||
autoload :StringCoercion
|
||||
end
|
||||
|
||||
autoload :MiddlewareStack, 'action_dispatch/middleware/stack'
|
||||
autoload :Routing
|
||||
|
||||
module Http
|
||||
autoload :Headers, 'action_dispatch/http/headers'
|
||||
end
|
||||
|
||||
module Session
|
||||
autoload :AbstractStore, 'action_dispatch/middleware/session/abstract_store'
|
||||
autoload :CookieStore, 'action_dispatch/middleware/session/cookie_store'
|
||||
autoload :MemCacheStore, 'action_dispatch/middleware/session/mem_cache_store'
|
||||
end
|
||||
|
||||
autoload_under 'testing' do
|
||||
autoload :Assertions
|
||||
autoload :Integration
|
||||
autoload :PerformanceTest
|
||||
autoload :TestProcess
|
||||
autoload :TestRequest
|
||||
autoload :TestResponse
|
||||
end
|
||||
autoload_under 'middleware' do
|
||||
autoload :Callbacks
|
||||
autoload :ParamsParser
|
||||
autoload :Rescue
|
||||
autoload :ShowExceptions
|
||||
autoload :Static
|
||||
autoload :StringCoercion
|
||||
end
|
||||
|
||||
autoload :HTML, 'action_controller/vendor/html-scanner'
|
||||
autoload :MiddlewareStack, 'action_dispatch/middleware/stack'
|
||||
autoload :Routing
|
||||
|
||||
module Http
|
||||
autoload :Headers, 'action_dispatch/http/headers'
|
||||
end
|
||||
|
||||
module Session
|
||||
autoload :AbstractStore, 'action_dispatch/middleware/session/abstract_store'
|
||||
autoload :CookieStore, 'action_dispatch/middleware/session/cookie_store'
|
||||
autoload :MemCacheStore, 'action_dispatch/middleware/session/mem_cache_store'
|
||||
end
|
||||
|
||||
autoload_under 'testing' do
|
||||
autoload :Assertions
|
||||
autoload :Integration
|
||||
autoload :PerformanceTest
|
||||
autoload :TestProcess
|
||||
autoload :TestRequest
|
||||
autoload :TestResponse
|
||||
end
|
||||
end
|
||||
|
||||
autoload :Mime, 'action_dispatch/http/mime_type'
|
||||
|
|
|
@ -18,7 +18,7 @@ module ActionDispatch
|
|||
|
||||
HTTP_ACCEPT HTTP_ACCEPT_CHARSET HTTP_ACCEPT_ENCODING
|
||||
HTTP_ACCEPT_LANGUAGE HTTP_CACHE_CONTROL HTTP_FROM
|
||||
HTTP_NEGOTIATE HTTP_PRAGMA HTTP_REFERER HTTP_USER_AGENT ].each do |env|
|
||||
HTTP_NEGOTIATE HTTP_PRAGMA ].each do |env|
|
||||
define_method(env.sub(/^HTTP_/n, '').downcase) do
|
||||
@env[env]
|
||||
end
|
||||
|
|
|
@ -60,7 +60,7 @@ module ActionDispatch # :nodoc:
|
|||
end
|
||||
|
||||
def status=(status)
|
||||
@status = ActionDispatch::StatusCodes[status]
|
||||
@status = Rack::Utils.status_code(status)
|
||||
end
|
||||
|
||||
# The response code of the request
|
||||
|
@ -74,7 +74,7 @@ module ActionDispatch # :nodoc:
|
|||
end
|
||||
|
||||
def message
|
||||
StatusCodes::STATUS_CODES[@status]
|
||||
Rack::Utils::HTTP_STATUS_CODES[@status]
|
||||
end
|
||||
alias_method :status_message, :message
|
||||
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
require 'active_support/inflector'
|
||||
|
||||
module ActionDispatch
|
||||
module StatusCodes #:nodoc:
|
||||
STATUS_CODES = Rack::Utils::HTTP_STATUS_CODES.merge({
|
||||
102 => "Processing",
|
||||
207 => "Multi-Status",
|
||||
226 => "IM Used",
|
||||
422 => "Unprocessable Entity",
|
||||
423 => "Locked",
|
||||
424 => "Failed Dependency",
|
||||
426 => "Upgrade Required",
|
||||
507 => "Insufficient Storage",
|
||||
510 => "Not Extended"
|
||||
}).freeze
|
||||
|
||||
def self.[](status)
|
||||
if status.is_a?(Symbol)
|
||||
SYMBOL_TO_STATUS_CODE[status] || 500
|
||||
else
|
||||
status.to_i
|
||||
end
|
||||
end
|
||||
|
||||
# Provides a symbol-to-fixnum lookup for converting a symbol (like
|
||||
# :created or :not_implemented) into its corresponding HTTP status
|
||||
# code (like 200 or 501).
|
||||
SYMBOL_TO_STATUS_CODE = STATUS_CODES.inject({}) { |hash, (code, message)|
|
||||
hash[ActiveSupport::Inflector.underscore(message.gsub(/ /, "")).to_sym] = code
|
||||
hash
|
||||
}.freeze
|
||||
end
|
||||
end
|
|
@ -1,4 +1,5 @@
|
|||
require 'active_support/json'
|
||||
require 'action_dispatch/http/request'
|
||||
|
||||
module ActionDispatch
|
||||
class ParamsParser
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require 'rack/utils'
|
||||
require 'rack/request'
|
||||
|
||||
module ActionDispatch
|
||||
module Session
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require "active_support/core_ext/hash/keys"
|
||||
require 'active_support/core_ext/hash/keys'
|
||||
require 'rack/request'
|
||||
|
||||
module ActionDispatch
|
||||
module Session
|
||||
|
@ -49,7 +50,7 @@ module ActionDispatch
|
|||
:expire_after => nil,
|
||||
:httponly => true
|
||||
}.freeze
|
||||
|
||||
|
||||
class OptionsHash < Hash
|
||||
def initialize(by, env, default_options)
|
||||
@session_data = env[CookieStore::ENV_SESSION_KEY]
|
||||
|
@ -60,7 +61,7 @@ module ActionDispatch
|
|||
key == :id ? @session_data[:session_id] : super(key)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ENV_SESSION_KEY = "rack.session".freeze
|
||||
ENV_SESSION_OPTIONS_KEY = "rack.session.options".freeze
|
||||
HTTP_SET_COOKIE = "Set-Cookie".freeze
|
||||
|
@ -102,7 +103,7 @@ module ActionDispatch
|
|||
def call(env)
|
||||
env[ENV_SESSION_KEY] = AbstractStore::SessionHash.new(self, env)
|
||||
env[ENV_SESSION_OPTIONS_KEY] = OptionsHash.new(self, env, @default_options)
|
||||
|
||||
|
||||
status, headers, body = @app.call(env)
|
||||
|
||||
session_data = env[ENV_SESSION_KEY]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
require "active_support/core_ext/exception"
|
||||
require 'active_support/core_ext/exception'
|
||||
require 'action_dispatch/http/request'
|
||||
|
||||
module ActionDispatch
|
||||
class ShowExceptions
|
||||
|
@ -101,7 +102,7 @@ module ActionDispatch
|
|||
end
|
||||
|
||||
def status_code(exception)
|
||||
ActionDispatch::StatusCodes::SYMBOL_TO_STATUS_CODE[@@rescue_responses[exception.class.name]]
|
||||
Rack::Utils.status_code(@@rescue_responses[exception.class.name])
|
||||
end
|
||||
|
||||
def render(status, body)
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'action_controller/vendor/html-scanner'
|
||||
|
||||
module ActionDispatch
|
||||
module Assertions
|
||||
module DomAssertions
|
||||
|
@ -15,7 +17,7 @@ module ActionDispatch
|
|||
|
||||
assert_block(full_message) { expected_dom == actual_dom }
|
||||
end
|
||||
|
||||
|
||||
# The negated form of +assert_dom_equivalent+.
|
||||
#
|
||||
# ==== Examples
|
||||
|
|
|
@ -28,7 +28,7 @@ module ActionDispatch
|
|||
assert_block("") { true } # to count the assertion
|
||||
elsif type.is_a?(Fixnum) && @response.response_code == type
|
||||
assert_block("") { true } # to count the assertion
|
||||
elsif type.is_a?(Symbol) && @response.response_code == ActionDispatch::StatusCodes::SYMBOL_TO_STATUS_CODE[type]
|
||||
elsif type.is_a?(Symbol) && @response.response_code == Rack::Utils::SYMBOL_TO_STATUS_CODE[type]
|
||||
assert_block("") { true } # to count the assertion
|
||||
else
|
||||
assert_block(build_message(message, "Expected response to be a <?>, but was <?>", type, @response.response_code)) { false }
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'action_controller/vendor/html-scanner'
|
||||
|
||||
#--
|
||||
# Copyright (c) 2006 Assaf Arkin (http://labnotes.org)
|
||||
# Under MIT and/or CC By license.
|
||||
|
@ -16,7 +18,7 @@ module ActionDispatch
|
|||
#
|
||||
# Use +css_select+ to select elements without making an assertions, either
|
||||
# from the response HTML or elements selected by the enclosing assertion.
|
||||
#
|
||||
#
|
||||
# In addition to HTML responses, you can make the following assertions:
|
||||
# * +assert_select_rjs+ - Assertions on HTML content of RJS update and insertion operations.
|
||||
# * +assert_select_encoded+ - Assertions on HTML encoded inside XML, for example for dealing with feed item descriptions.
|
||||
|
@ -53,8 +55,8 @@ module ActionDispatch
|
|||
# end
|
||||
#
|
||||
# # Selects all list items in unordered lists
|
||||
# items = css_select("ul>li")
|
||||
#
|
||||
# items = css_select("ul>li")
|
||||
#
|
||||
# # Selects all form tags and then all inputs inside the form
|
||||
# forms = css_select("form")
|
||||
# forms.each do |form|
|
||||
|
@ -212,7 +214,7 @@ module ActionDispatch
|
|||
# Otherwise just operate on the response document.
|
||||
root = response_from_page_or_rjs
|
||||
end
|
||||
|
||||
|
||||
# First or second argument is the selector: string and we pass
|
||||
# all remaining arguments. Array and we pass the argument. Also
|
||||
# accepts selector itself.
|
||||
|
@ -225,7 +227,7 @@ module ActionDispatch
|
|||
selector = arg
|
||||
else raise ArgumentError, "Expecting a selector as the first argument"
|
||||
end
|
||||
|
||||
|
||||
# Next argument is used for equality tests.
|
||||
equals = {}
|
||||
case arg = args.shift
|
||||
|
@ -315,10 +317,10 @@ module ActionDispatch
|
|||
# Returns all matches elements.
|
||||
matches
|
||||
end
|
||||
|
||||
|
||||
def count_description(min, max) #:nodoc:
|
||||
pluralize = lambda {|word, quantity| word << (quantity == 1 ? '' : 's')}
|
||||
|
||||
|
||||
if min && max && (max != min)
|
||||
"between #{min} and #{max} elements"
|
||||
elsif min && !(min == 1 && max == 1)
|
||||
|
@ -327,7 +329,7 @@ module ActionDispatch
|
|||
"at most #{max} #{pluralize['element', max]}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# :call-seq:
|
||||
# assert_select_rjs(id?) { |elements| ... }
|
||||
# assert_select_rjs(statement, id?) { |elements| ... }
|
||||
|
@ -344,7 +346,7 @@ module ActionDispatch
|
|||
# that update or insert an element with that identifier.
|
||||
#
|
||||
# Use the first argument to narrow down assertions to only statements
|
||||
# of that type. Possible values are <tt>:replace</tt>, <tt>:replace_html</tt>,
|
||||
# of that type. Possible values are <tt>:replace</tt>, <tt>:replace_html</tt>,
|
||||
# <tt>:show</tt>, <tt>:hide</tt>, <tt>:toggle</tt>, <tt>:remove</tta>,
|
||||
# <tt>:insert_html</tt> and <tt>:redirect</tt>.
|
||||
#
|
||||
|
@ -494,7 +496,7 @@ module ActionDispatch
|
|||
# end
|
||||
# end
|
||||
# end
|
||||
#
|
||||
#
|
||||
#
|
||||
# # Selects all paragraph tags from within the description of an RSS feed
|
||||
# assert_select_feed :rss, 2.0 do
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require 'action_controller/vendor/html-scanner'
|
||||
|
||||
module ActionDispatch
|
||||
module Assertions
|
||||
# Pair of assertions to testing elements in the HTML output of the response.
|
||||
|
|
|
@ -31,27 +31,28 @@ require 'action_pack'
|
|||
module ActionView
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Base
|
||||
autoload :Context
|
||||
autoload :Template
|
||||
autoload :Helpers
|
||||
autoload :SafeBuffer
|
||||
eager_autoload do
|
||||
autoload :Base
|
||||
autoload :Context
|
||||
autoload :Template
|
||||
autoload :Helpers
|
||||
autoload :SafeBuffer
|
||||
|
||||
autoload_under "render" do
|
||||
autoload :Partials
|
||||
autoload :Rendering
|
||||
end
|
||||
|
||||
autoload_under "render" do
|
||||
autoload :Partials
|
||||
autoload :Rendering
|
||||
autoload :MissingTemplate, 'action_view/base'
|
||||
autoload :Resolver, 'action_view/template/resolver'
|
||||
autoload :PathResolver, 'action_view/template/resolver'
|
||||
autoload :PathSet, 'action_view/paths'
|
||||
autoload :FileSystemResolverWithFallback, 'action_view/template/resolver'
|
||||
|
||||
autoload :TemplateError, 'action_view/template/error'
|
||||
autoload :TemplateHandler, 'action_view/template'
|
||||
autoload :TemplateHandlers, 'action_view/template'
|
||||
end
|
||||
|
||||
autoload :MissingTemplate, 'action_view/base'
|
||||
autoload :Resolver, 'action_view/template/resolver'
|
||||
autoload :PathResolver, 'action_view/template/resolver'
|
||||
autoload :PathSet, 'action_view/paths'
|
||||
autoload :FileSystemResolverWithFallback, 'action_view/template/resolver'
|
||||
|
||||
autoload :TemplateError, 'action_view/template/error'
|
||||
autoload :TemplateHandler, 'action_view/template'
|
||||
autoload :TemplateHandlers, 'action_view/template'
|
||||
end
|
||||
|
||||
require 'action_view/erb/util'
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require 'action_controller/vendor/html-scanner'
|
||||
require 'action_view/helpers/tag_helper'
|
||||
|
||||
module ActionView
|
||||
|
|
|
@ -7,12 +7,14 @@ require "action_view/template/resolver"
|
|||
module ActionView
|
||||
class Template
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Error
|
||||
autoload :Handler
|
||||
autoload :Handlers
|
||||
autoload :Text
|
||||
|
||||
|
||||
eager_autoload do
|
||||
autoload :Error
|
||||
autoload :Handler
|
||||
autoload :Handlers
|
||||
autoload :Text
|
||||
end
|
||||
|
||||
extend Template::Handlers
|
||||
attr_reader :source, :identifier, :handler, :mime_type, :formats, :details
|
||||
|
||||
|
|
|
@ -1125,7 +1125,7 @@ class RenderTest < ActionController::TestCase
|
|||
assert !@response.headers.include?('Content-Length')
|
||||
assert_response :no_content
|
||||
|
||||
ActionDispatch::StatusCodes::SYMBOL_TO_STATUS_CODE.each do |status, code|
|
||||
Rack::Utils::SYMBOL_TO_STATUS_CODE.each do |status, code|
|
||||
get :head_with_symbolic_status, :status => status.to_s
|
||||
assert_equal code, @response.response_code
|
||||
assert_response status
|
||||
|
@ -1133,7 +1133,7 @@ class RenderTest < ActionController::TestCase
|
|||
end
|
||||
|
||||
def test_head_with_integer_status
|
||||
ActionDispatch::StatusCodes::STATUS_CODES.each do |code, message|
|
||||
Rack::Utils::HTTP_STATUS_CODES.each do |code, message|
|
||||
get :head_with_integer_status, :status => code.to_s
|
||||
assert_equal message, @response.message
|
||||
end
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require 'active_support/core_ext/array/extract_options'
|
||||
require 'active_support/core_ext/hash/keys'
|
||||
require 'active_model/errors'
|
||||
|
||||
module ActiveModel
|
||||
module Validations
|
||||
|
|
|
@ -35,82 +35,94 @@ require 'arel'
|
|||
module ActiveRecord
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :VERSION
|
||||
eager_autoload do
|
||||
autoload :VERSION
|
||||
|
||||
autoload :ActiveRecordError, 'active_record/base'
|
||||
autoload :ConnectionNotEstablished, 'active_record/base'
|
||||
autoload :ActiveRecordError, 'active_record/base'
|
||||
autoload :ConnectionNotEstablished, 'active_record/base'
|
||||
|
||||
autoload :Aggregations
|
||||
autoload :AssociationPreload
|
||||
autoload :Associations
|
||||
autoload :AttributeMethods
|
||||
autoload :Attributes
|
||||
autoload :AutosaveAssociation
|
||||
autoload :Relation
|
||||
autoload :Base
|
||||
autoload :Batches
|
||||
autoload :Calculations
|
||||
autoload :Callbacks
|
||||
autoload :DynamicFinderMatch
|
||||
autoload :DynamicScopeMatch
|
||||
autoload :Migration
|
||||
autoload :Migrator, 'active_record/migration'
|
||||
autoload :NamedScope
|
||||
autoload :NestedAttributes
|
||||
autoload :Observer
|
||||
autoload :QueryCache
|
||||
autoload :Reflection
|
||||
autoload :Schema
|
||||
autoload :SchemaDumper
|
||||
autoload :Serialization
|
||||
autoload :SessionStore
|
||||
autoload :StateMachine
|
||||
autoload :Timestamp
|
||||
autoload :Transactions
|
||||
autoload :Types
|
||||
autoload :Validations
|
||||
autoload :Aggregations
|
||||
autoload :AssociationPreload
|
||||
autoload :Associations
|
||||
autoload :AttributeMethods
|
||||
autoload :Attributes
|
||||
autoload :AutosaveAssociation
|
||||
autoload :Relation
|
||||
autoload :Base
|
||||
autoload :Batches
|
||||
autoload :Calculations
|
||||
autoload :Callbacks
|
||||
autoload :DynamicFinderMatch
|
||||
autoload :DynamicScopeMatch
|
||||
autoload :Migration
|
||||
autoload :Migrator, 'active_record/migration'
|
||||
autoload :NamedScope
|
||||
autoload :NestedAttributes
|
||||
autoload :Observer
|
||||
autoload :QueryCache
|
||||
autoload :Reflection
|
||||
autoload :Schema
|
||||
autoload :SchemaDumper
|
||||
autoload :Serialization
|
||||
autoload :SessionStore
|
||||
autoload :StateMachine
|
||||
autoload :Timestamp
|
||||
autoload :Transactions
|
||||
autoload :Types
|
||||
autoload :Validations
|
||||
end
|
||||
|
||||
module AttributeMethods
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :BeforeTypeCast
|
||||
autoload :Dirty
|
||||
autoload :PrimaryKey
|
||||
autoload :Query
|
||||
autoload :Read
|
||||
autoload :TimeZoneConversion
|
||||
autoload :Write
|
||||
eager_autoload do
|
||||
autoload :BeforeTypeCast
|
||||
autoload :Dirty
|
||||
autoload :PrimaryKey
|
||||
autoload :Query
|
||||
autoload :Read
|
||||
autoload :TimeZoneConversion
|
||||
autoload :Write
|
||||
end
|
||||
end
|
||||
|
||||
module Attributes
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Aliasing
|
||||
autoload :Store
|
||||
autoload :Typecasting
|
||||
eager_autoload do
|
||||
autoload :Aliasing
|
||||
autoload :Store
|
||||
autoload :Typecasting
|
||||
end
|
||||
end
|
||||
|
||||
module Type
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Number, 'active_record/types/number'
|
||||
autoload :Object, 'active_record/types/object'
|
||||
autoload :Serialize, 'active_record/types/serialize'
|
||||
autoload :TimeWithZone, 'active_record/types/time_with_zone'
|
||||
autoload :Unknown, 'active_record/types/unknown'
|
||||
eager_autoload do
|
||||
autoload :Number, 'active_record/types/number'
|
||||
autoload :Object, 'active_record/types/object'
|
||||
autoload :Serialize, 'active_record/types/serialize'
|
||||
autoload :TimeWithZone, 'active_record/types/time_with_zone'
|
||||
autoload :Unknown, 'active_record/types/unknown'
|
||||
end
|
||||
end
|
||||
|
||||
module Locking
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :Optimistic
|
||||
autoload :Pessimistic
|
||||
eager_autoload do
|
||||
autoload :Optimistic
|
||||
autoload :Pessimistic
|
||||
end
|
||||
end
|
||||
|
||||
module ConnectionAdapters
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :AbstractAdapter
|
||||
eager_autoload do
|
||||
autoload :AbstractAdapter
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ require 'set'
|
|||
require 'uri'
|
||||
|
||||
require 'active_resource/exceptions'
|
||||
require 'active_resource/connection'
|
||||
require 'active_resource/formats'
|
||||
require 'active_resource/schema'
|
||||
|
||||
module ActiveResource
|
||||
# ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application.
|
||||
|
|
|
@ -39,31 +39,34 @@ require "active_support/dependencies/autoload"
|
|||
module ActiveSupport
|
||||
extend ActiveSupport::Autoload
|
||||
|
||||
autoload :BacktraceCleaner
|
||||
autoload :Base64
|
||||
autoload :BasicObject
|
||||
autoload :Benchmarkable
|
||||
autoload :BufferedLogger
|
||||
autoload :Cache
|
||||
autoload :Callbacks
|
||||
autoload :Concern
|
||||
autoload :Configurable
|
||||
autoload :DeprecatedCallbacks
|
||||
autoload :Deprecation
|
||||
autoload :Gzip
|
||||
autoload :Inflector
|
||||
autoload :Memoizable
|
||||
autoload :MessageEncryptor
|
||||
autoload :MessageVerifier
|
||||
autoload :Multibyte
|
||||
autoload :OptionMerger
|
||||
autoload :OrderedHash
|
||||
autoload :OrderedOptions
|
||||
autoload :Notifications
|
||||
autoload :Rescuable
|
||||
autoload :SecureRandom
|
||||
autoload :StringInquirer
|
||||
autoload :XmlMini
|
||||
# TODO: Narrow this list down
|
||||
eager_autoload do
|
||||
autoload :BacktraceCleaner
|
||||
autoload :Base64
|
||||
autoload :BasicObject
|
||||
autoload :Benchmarkable
|
||||
autoload :BufferedLogger
|
||||
autoload :Cache
|
||||
autoload :Callbacks
|
||||
autoload :Concern
|
||||
autoload :Configurable
|
||||
autoload :DeprecatedCallbacks
|
||||
autoload :Deprecation
|
||||
autoload :Gzip
|
||||
autoload :Inflector
|
||||
autoload :Memoizable
|
||||
autoload :MessageEncryptor
|
||||
autoload :MessageVerifier
|
||||
autoload :Multibyte
|
||||
autoload :OptionMerger
|
||||
autoload :OrderedHash
|
||||
autoload :OrderedOptions
|
||||
autoload :Notifications
|
||||
autoload :Rescuable
|
||||
autoload :SecureRandom
|
||||
autoload :StringInquirer
|
||||
autoload :XmlMini
|
||||
end
|
||||
end
|
||||
|
||||
require 'active_support/vendor'
|
||||
|
|
|
@ -5,13 +5,13 @@ module ActiveSupport
|
|||
@@autoloads = {}
|
||||
@@under_path = nil
|
||||
@@at_path = nil
|
||||
@@autoload_defer = false
|
||||
@@eager_autoload = false
|
||||
|
||||
def autoload(const_name, path = @@at_path)
|
||||
full = [self.name, @@under_path, const_name.to_s, path].compact.join("::")
|
||||
location = path || Inflector.underscore(full)
|
||||
|
||||
unless @@autoload_defer
|
||||
if @@eager_autoload
|
||||
@@autoloads[const_name] = location
|
||||
end
|
||||
super const_name, location
|
||||
|
@ -31,11 +31,11 @@ module ActiveSupport
|
|||
@@at_path = old_path
|
||||
end
|
||||
|
||||
def deferrable
|
||||
old_defer, @@autoload_defer = @@autoload_defer, true
|
||||
def eager_autoload
|
||||
old_eager, @@eager_autoload = @@eager_autoload, true
|
||||
yield
|
||||
ensure
|
||||
@@autoload_defer = old_defer
|
||||
@@eager_autoload = old_eager
|
||||
end
|
||||
|
||||
def self.eager_autoload!
|
||||
|
|
|
@ -208,6 +208,7 @@ module Rails
|
|||
initializer :initialize_middleware_stack do
|
||||
if config.frameworks.include?(:action_controller)
|
||||
config.middleware.use(::Rack::Lock, :if => lambda { ActionController::Base.allow_concurrency })
|
||||
config.middleware.use(::Rack::Runtime)
|
||||
config.middleware.use(ActionDispatch::ShowExceptions, lambda { ActionController::Base.consider_all_requests_local })
|
||||
config.middleware.use(ActionDispatch::Callbacks, lambda { ActionController::Dispatcher.prepare_each_request })
|
||||
config.middleware.use(lambda { ActionController::Base.session_store }, lambda { ActionController::Base.session_options })
|
||||
|
|
Loading…
Reference in a new issue