diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-06-08 20:48:14 -0500 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-06-08 20:48:14 -0500 |
commit | 0b694a4ff41dbb7f64b6ea4cb088c2c2ba26b569 (patch) | |
tree | bfbaa2c0b2d6ff0b9e4eda0684f9c7bd2d48d89d /activeresource/lib | |
parent | 28f36279cd484dc66b8b0ca2f0c3d75fd9ac631c (diff) | |
download | rails-0b694a4ff41dbb7f64b6ea4cb088c2c2ba26b569.tar.gz rails-0b694a4ff41dbb7f64b6ea4cb088c2c2ba26b569.tar.bz2 rails-0b694a4ff41dbb7f64b6ea4cb088c2c2ba26b569.zip |
Setup ActiveResource autoloads
Diffstat (limited to 'activeresource/lib')
-rw-r--r-- | activeresource/lib/active_resource.rb | 19 | ||||
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 12 | ||||
-rw-r--r-- | activeresource/lib/active_resource/connection.rb | 2 | ||||
-rw-r--r-- | activeresource/lib/active_resource/custom_methods.rb | 4 | ||||
-rw-r--r-- | activeresource/lib/active_resource/http_mock.rb | 1 | ||||
-rw-r--r-- | activeresource/lib/active_resource/validations.rb | 5 |
6 files changed, 14 insertions, 29 deletions
diff --git a/activeresource/lib/active_resource.rb b/activeresource/lib/active_resource.rb index b46801affc..1dcb795a7d 100644 --- a/activeresource/lib/active_resource.rb +++ b/activeresource/lib/active_resource.rb @@ -25,18 +25,15 @@ activesupport_path = "#{File.dirname(__FILE__)}/../../activesupport/lib" $:.unshift(activesupport_path) if File.directory?(activesupport_path) require 'active_support' -begin - require 'active_model' -rescue LoadError - $:.unshift "#{File.dirname(__FILE__)}/../../activemodel/lib" - require 'active_model' -end - -require 'active_resource/formats' -require 'active_resource/base' -require 'active_resource/validations' -require 'active_resource/custom_methods' +activemodel_path = "#{File.dirname(__FILE__)}/../../activemodel/lib" +$:.unshift(activemodel_path) if File.directory?(activemodel_path) +require 'active_model' module ActiveResource autoload :Base, 'active_resource/base' + autoload :Connection, 'active_resource/connection' + autoload :CustomMethods, 'active_resource/custom_methods' + autoload :Formats, 'active_resource/formats' + autoload :Validations, 'active_resource/validations' + autoload :HttpMock, 'active_resource/http_mock' end diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index dbc418bef3..a4f2a7e16a 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -10,10 +10,9 @@ require 'active_support/core_ext/object/misc' require 'set' require 'uri' -module ActiveResource - autoload :Formats, 'active_resource/formats' - autoload :Connection, 'active_resource/connection' +require 'active_resource/exceptions' +module ActiveResource # ActiveResource::Base is the main class for mapping RESTful resources as models in a Rails application. # # For an outline of what Active Resource is capable of, see link:files/vendor/rails/activeresource/README.html. @@ -1085,7 +1084,8 @@ module ActiveResource end end end -end -require 'active_resource/validations' -require 'active_resource/custom_methods' + class Base + include CustomMethods, Validations + end +end diff --git a/activeresource/lib/active_resource/connection.rb b/activeresource/lib/active_resource/connection.rb index 6661469c5b..fb3fde59d6 100644 --- a/activeresource/lib/active_resource/connection.rb +++ b/activeresource/lib/active_resource/connection.rb @@ -1,5 +1,3 @@ -require 'active_resource/exceptions' -require 'active_resource/formats' require 'active_support/core_ext/benchmark' require 'net/https' require 'date' diff --git a/activeresource/lib/active_resource/custom_methods.rb b/activeresource/lib/active_resource/custom_methods.rb index 0d05d06035..4647e8342c 100644 --- a/activeresource/lib/active_resource/custom_methods.rb +++ b/activeresource/lib/active_resource/custom_methods.rb @@ -117,8 +117,4 @@ module ActiveResource end end end - - class Base - include CustomMethods - end end diff --git a/activeresource/lib/active_resource/http_mock.rb b/activeresource/lib/active_resource/http_mock.rb index aae2d6508c..e5891300a6 100644 --- a/activeresource/lib/active_resource/http_mock.rb +++ b/activeresource/lib/active_resource/http_mock.rb @@ -1,4 +1,3 @@ -require 'active_resource/connection' require 'active_support/core_ext/kernel/reporting' module ActiveResource diff --git a/activeresource/lib/active_resource/validations.rb b/activeresource/lib/active_resource/validations.rb index 95c5467647..e029076079 100644 --- a/activeresource/lib/active_resource/validations.rb +++ b/activeresource/lib/active_resource/validations.rb @@ -1,4 +1,3 @@ -require 'active_resource/exceptions' require 'active_support/core_ext/array/wrap' module ActiveResource @@ -80,8 +79,4 @@ module ActiveResource @errors ||= Errors.new(self) end end - - class Base - include Validations - end end |