aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource/base.rb
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-11 17:07:05 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-05-11 17:07:05 -0700
commit00a9d4b91cccdd88146cbe716eca844dcdfa08e7 (patch)
tree77398a4e98eb391258813fef47f1ecf57ae58972 /activeresource/lib/active_resource/base.rb
parent0f6e764e4060b75ea8a335e6971209a08bf8b40a (diff)
parent0cac68d3bed3e6bf8ec2eb994858e4a179046941 (diff)
downloadrails-00a9d4b91cccdd88146cbe716eca844dcdfa08e7.tar.gz
rails-00a9d4b91cccdd88146cbe716eca844dcdfa08e7.tar.bz2
rails-00a9d4b91cccdd88146cbe716eca844dcdfa08e7.zip
Merge branch 'master' into wip_abstract_controller
Conflicts: actionpack/lib/action_controller/abstract/callbacks.rb actionpack/lib/action_controller/abstract/renderer.rb actionpack/lib/action_controller/base/base.rb actionpack/lib/action_controller/dispatch/dispatcher.rb actionpack/lib/action_controller/routing/route_set.rb actionpack/lib/action_controller/testing/process.rb actionpack/test/abstract_controller/layouts_test.rb actionpack/test/controller/filters_test.rb actionpack/test/controller/helper_test.rb actionpack/test/controller/render_test.rb actionpack/test/new_base/test_helper.rb
Diffstat (limited to 'activeresource/lib/active_resource/base.rb')
-rw-r--r--activeresource/lib/active_resource/base.rb18
1 files changed, 14 insertions, 4 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index f9a461d02e..8a1236c9a8 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -1,8 +1,15 @@
-require 'active_resource/connection'
-require 'cgi'
+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 'active_support/core_ext/object/misc'
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.
@@ -298,7 +305,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.
@@ -895,7 +902,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)
@@ -1080,3 +1087,6 @@ module ActiveResource
end
end
end
+
+require 'active_resource/validations'
+require 'active_resource/custom_methods'