Skip to content
Browse files

Setup explicit requires for files with exceptions. Removed them from …

…autoloading.

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent c5c839f commit 38a421b34d0b414564e919f67d339fac067a56e6 @lukaszx0 lukaszx0 committed with josevalim Aug 11, 2010
Showing with 32 additions and 16 deletions.
  1. +0 −15 actionpack/lib/action_controller.rb
  2. +2 −0 actionpack/lib/action_controller/metal/compatibility.rb
  3. +2 −0 actionpack/lib/action_controller/metal/redirecting.rb
  4. +1 −0 actionpack/lib/action_controller/metal/request_forgery_protection.rb
  5. +1 −0 actionpack/lib/action_controller/metal/streaming.rb
  6. +1 −0 actionpack/lib/action_dispatch/http/request.rb
  7. +1 −0 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
  8. +1 −0 actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
  9. +1 −0 actionpack/lib/action_dispatch/routing/route_set.rb
  10. +1 −0 actionpack/lib/action_view/template/resolver.rb
  11. +1 −0 actionpack/test/controller/redirect_test.rb
  12. +1 −0 actionpack/test/controller/rescue_test.rb
  13. +1 −0 actionpack/test/controller/resources_test.rb
  14. +1 −0 actionpack/test/controller/routing_test.rb
  15. +1 −0 actionpack/test/dispatch/request_test.rb
  16. +1 −0 actionpack/test/dispatch/routing_test.rb
  17. +1 −0 actionpack/test/dispatch/show_exceptions_test.rb
  18. +1 −0 activemodel/lib/active_model/validator.rb
  19. +1 −0 activerecord/lib/active_record/base.rb
  20. +1 −0 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
  21. +1 −0 activerecord/lib/active_record/migration.rb
  22. +2 −0 activerecord/lib/active_record/session_store.rb
  23. +2 −1 activeresource/lib/active_resource/connection.rb
  24. +2 −0 activeresource/lib/active_resource/exceptions.rb
  25. +1 −0 activeresource/test/connection_test.rb
  26. +1 −0 activesupport/lib/active_support/cache.rb
  27. +2 −0 activesupport/lib/active_support/secure_random.rb
View
15 actionpack/lib/action_controller.rb
@@ -43,21 +43,6 @@ module ActionController
eager_autoload do
autoload :RecordIdentifier
-
- # 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
View
2 actionpack/lib/action_controller/metal/compatibility.rb
@@ -1,3 +1,5 @@
+require 'action_controller/metal/exceptions'
+
module ActionController
module Compatibility
extend ActiveSupport::Concern
View
2 actionpack/lib/action_controller/metal/redirecting.rb
@@ -1,3 +1,5 @@
+require 'action_controller/metal/exceptions'
+
module ActionController
class RedirectBackError < AbstractController::Error #:nodoc:
DEFAULT_MESSAGE = 'No HTTP_REFERER was set in the request to this action, so redirect_to :back could not be called successfully. If this is a test, make sure to specify request.env["HTTP_REFERER"].'
View
1 actionpack/lib/action_controller/metal/request_forgery_protection.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/class/attribute'
+require 'action_controller/metal/exceptions'
module ActionController #:nodoc:
class InvalidAuthenticityToken < ActionControllerError #:nodoc:
View
1 actionpack/lib/action_controller/metal/streaming.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/file/path'
+require 'action_controller/metal/exceptions'
module ActionController #:nodoc:
# Methods for sending arbitrary data and for streaming files to the browser,
View
1 actionpack/lib/action_dispatch/http/request.rb
@@ -5,6 +5,7 @@
require 'active_support/core_ext/hash/indifferent_access'
require 'active_support/core_ext/string/access'
require 'action_dispatch/http/headers'
+require 'action_controller/metal/exceptions'
module ActionDispatch
class Request < Rack::Request
View
1 actionpack/lib/action_dispatch/middleware/show_exceptions.rb
@@ -1,6 +1,7 @@
require 'active_support/core_ext/exception'
require 'active_support/notifications'
require 'action_dispatch/http/request'
+require 'action_controller/metal/exceptions'
module ActionDispatch
# This middleware rescues any exception returned by the application and renders
View
1 actionpack/lib/action_dispatch/routing/deprecated_mapper.rb
@@ -1,6 +1,7 @@
require 'active_support/core_ext/object/blank'
require 'active_support/core_ext/object/with_options'
require 'active_support/core_ext/object/try'
+require 'action_controller/metal/exceptions'
module ActionDispatch
module Routing
View
1 actionpack/lib/action_dispatch/routing/route_set.rb
@@ -2,6 +2,7 @@
require 'forwardable'
require 'active_support/core_ext/object/to_query'
require 'action_dispatch/routing/deprecated_mapper'
+require 'action_controller/metal/exceptions'
module ActionDispatch
module Routing
View
1 actionpack/lib/action_view/template/resolver.rb
@@ -1,6 +1,7 @@
require "pathname"
require "active_support/core_ext/class"
require "action_view/template"
+require 'action_controller/metal/exceptions'
module ActionView
# = Action View Resolver
View
1 actionpack/test/controller/redirect_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'action_controller/metal/exceptions'
class WorkshopsController < ActionController::Base
end
View
1 actionpack/test/controller/rescue_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'action_controller/metal/exceptions'
module ActionDispatch
class ShowExceptions
View
1 actionpack/test/controller/resources_test.rb
@@ -1,5 +1,6 @@
require 'abstract_unit'
require 'active_support/core_ext/object/try'
+require 'action_controller/metal/exceptions'
class ResourcesController < ActionController::Base
def index() render :nothing => true end
View
1 actionpack/test/controller/routing_test.rb
@@ -2,6 +2,7 @@
require 'abstract_unit'
require 'controller/fake_controllers'
require 'active_support/dependencies'
+require 'action_controller/metal/exceptions'
class MilestonesController < ActionController::Base
def index() head :ok end
View
1 actionpack/test/dispatch/request_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'action_controller/metal/exceptions'
class RequestTest < ActiveSupport::TestCase
test "remote ip" do
View
1 actionpack/test/dispatch/routing_test.rb
@@ -1,6 +1,7 @@
require 'erb'
require 'abstract_unit'
require 'controller/fake_controllers'
+require 'action_controller/metal/exceptions'
class TestRoutingMapper < ActionDispatch::IntegrationTest
SprocketsApp = lambda { |env|
View
1 actionpack/test/dispatch/show_exceptions_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'action_controller/metal/exceptions'
module ActionDispatch
class ShowExceptions
View
1 activemodel/lib/active_model/validator.rb
@@ -1,6 +1,7 @@
require 'active_support/core_ext/array/wrap'
require "active_support/core_ext/module/anonymous"
require 'active_support/core_ext/object/blank'
+require 'action_controller/metal/exceptions'
module ActiveModel #:nodoc:
View
1 activerecord/lib/active_record/base.rb
@@ -22,6 +22,7 @@
require 'arel'
require 'active_record/errors'
require 'active_record/log_subscriber'
+require 'action_controller/metal/exceptions'
module ActiveRecord #:nodoc:
# = Active Record
View
1 activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb
@@ -1,4 +1,5 @@
require 'active_support/core_ext/array/wrap'
+require 'action_controller/metal/exceptions'
module ActiveRecord
module ConnectionAdapters # :nodoc:
View
1 activerecord/lib/active_record/migration.rb
@@ -1,5 +1,6 @@
require 'active_support/core_ext/kernel/singleton_class'
require 'active_support/core_ext/module/aliasing'
+require 'action_controller/metal/exceptions'
module ActiveRecord
# Exception that can be raised to stop migrations from going backwards.
View
2 activerecord/lib/active_record/session_store.rb
@@ -1,3 +1,5 @@
+require 'action_controller/metal/exceptions'
+
module ActiveRecord
# = Active Record Session Store
#
View
3 activeresource/lib/active_resource/connection.rb
@@ -1,8 +1,9 @@
-require 'active_support/core_ext/benchmark'
require 'net/https'
require 'date'
require 'time'
require 'uri'
+require 'active_support/core_ext/benchmark'
+require 'action_controller/metal/exceptions'
module ActiveResource
# Class to handle connections to remote web services.
View
2 activeresource/lib/active_resource/exceptions.rb
@@ -1,3 +1,5 @@
+require 'action_controller/metal/exceptions'
+
module ActiveResource
class ConnectionError < StandardError # :nodoc:
attr_reader :response
View
1 activeresource/test/connection_test.rb
@@ -1,4 +1,5 @@
require 'abstract_unit'
+require 'action_controller/metal/exceptions'
class ConnectionTest < Test::Unit::TestCase
ResponseCodeStub = Struct.new(:code)
View
1 activesupport/lib/active_support/cache.rb
@@ -9,6 +9,7 @@
require 'active_support/core_ext/numeric/time'
require 'active_support/core_ext/object/to_param'
require 'active_support/core_ext/string/inflections'
+require 'action_controller/metal/exceptions'
module ActiveSupport
# See ActiveSupport::Cache::Store for documentation.
View
2 activesupport/lib/active_support/secure_random.rb
@@ -1,3 +1,5 @@
+require 'action_controller/metal/exceptions'
+
begin
require 'securerandom'
rescue LoadError

2 comments on commit 38a421b

@rubys
rubys commented on 38a421b Sep 2, 2010

$ ruby bin/rails new ~/tmp/app
internal:lib/rubygems/custom_require:29:in require': no such file to load -- action_controller/metal/exceptions (LoadError)
from <internal:lib/rubygems/custom_require>:29:in
require'
from /home/rubys/git/rails/activesupport/lib/active_support/secure_random.rb:1:in <top (required)>'
from <internal:lib/rubygems/custom_require>:29:in
require'
from internal:lib/rubygems/custom_require:29:in require'
from /home/rubys/git/rails/railties/lib/rails/generators/rails/app/app_generator.rb:2:in
'
from internal:lib/rubygems/custom_require:29:in require'
from <internal:lib/rubygems/custom_require>:29:in
require'
from /home/rubys/git/rails/railties/lib/rails/commands/application.rb:16:in <top (required)>'
from <internal:lib/rubygems/custom_require>:29:in
require'
from internal:lib/rubygems/custom_require:29:in require'
from /home/rubys/git/rails/railties/lib/rails/cli.rb:14:in
'
from internal:lib/rubygems/custom_require:29:in require'
from <internal:lib/rubygems/custom_require>:29:in
require'
from bin/rails:8:in rescue in <main>'
from bin/rails:3:in

'

@josevalim
Ruby on Rails member

Reverted! Thank you very much Sam!

Please sign in to comment.
Something went wrong with that request. Please try again.