diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-06 00:14:55 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-06 00:14:55 -0700 |
commit | 6d4a4fabbbb04c20cee51c4e374045cc75e2ec16 (patch) | |
tree | ea8067c8494363f2bf40a8992ea94600f623f304 /activeresource/lib/active_resource/base.rb | |
parent | c585e263ab40101eb0fd71a1d24d0d704f4ce026 (diff) | |
download | rails-6d4a4fabbbb04c20cee51c4e374045cc75e2ec16.tar.gz rails-6d4a4fabbbb04c20cee51c4e374045cc75e2ec16.tar.bz2 rails-6d4a4fabbbb04c20cee51c4e374045cc75e2ec16.zip |
Cherry pick Active Support dependencies. Autoload.
Diffstat (limited to 'activeresource/lib/active_resource/base.rb')
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index 590d4f6232..be022f5c44 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -1,7 +1,14 @@ -require 'active_resource/connection' +require 'active_support/core_ext/class/attribute_accessors' +require 'active_support/core_ext/class/inheritable_attributes' +require 'active_support/core_ext/module/attr_accessor_with_default' +require 'active_support/core_ext/module/delegation' +require 'active_support/core_ext/module/aliasing' require 'set' module ActiveResource + autoload :Formats, 'active_resource/formats' + autoload :Connection, 'active_resource/connection' + # 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. @@ -297,7 +304,7 @@ module ActiveResource # Returns the current format, default is ActiveResource::Formats::XmlFormat. def format - read_inheritable_attribute(:format) || ActiveResource::Formats[:xml] + read_inheritable_attribute(:format) || ActiveResource::Formats::XmlFormat end # Sets the number of seconds after which requests to the REST API should time out. @@ -894,7 +901,7 @@ module ActiveResource # applicable depend on the configured encoding format. def encode(options={}) case self.class.format - when ActiveResource::Formats[:xml] + when ActiveResource::Formats::XmlFormat self.class.format.encode(attributes, {:root => self.class.element_name}.merge(options)) else self.class.format.encode(attributes, options) @@ -1079,3 +1086,6 @@ module ActiveResource end end end + +require 'active_resource/validations' +require 'active_resource/custom_methods' |