diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-05-06 12:35:08 -0300 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2010-05-12 09:31:36 -0700 |
commit | bea3c26833ad3e1e94f7331e0553a4e2164e7de5 (patch) | |
tree | 67feace8da33b390feff26618e7f42826437a7f9 /activeresource/lib | |
parent | f7862b2c34b5b298bf7b937c55f0637ebfe43a25 (diff) | |
download | rails-bea3c26833ad3e1e94f7331e0553a4e2164e7de5.tar.gz rails-bea3c26833ad3e1e94f7331e0553a4e2164e7de5.tar.bz2 rails-bea3c26833ad3e1e94f7331e0553a4e2164e7de5.zip |
Make ActiveResource serialize XML correctly when element_name is set.
[#4529]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activeresource/lib')
-rw-r--r-- | activeresource/lib/active_resource/base.rb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb index ad994214f6..15d77df3b5 100644 --- a/activeresource/lib/active_resource/base.rb +++ b/activeresource/lib/active_resource/base.rb @@ -551,11 +551,22 @@ module ActiveResource @headers ||= {} end - # Do not include any modules in the default element name. This makes it easier to seclude ARes objects - # in a separate namespace without having to set element_name repeatedly. - attr_accessor_with_default(:element_name) { ActiveSupport::Inflector.underscore(to_s.split("::").last) } #:nodoc: + def element_name + model_name.element + end + + def element_name=(value) + model_name.element = value + end + + def collection_name + model_name.collection + end + + def collection_name=(value) + model_name.collection = value + end - attr_accessor_with_default(:collection_name) { ActiveSupport::Inflector.pluralize(element_name) } #:nodoc: attr_accessor_with_default(:primary_key, 'id') #:nodoc: # Gets the \prefix for a resource's nested URL (e.g., <tt>prefix/collectionname/1.xml</tt>) |