aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource/lib/active_resource/base.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activeresource/lib/active_resource/base.rb')
-rw-r--r--activeresource/lib/active_resource/base.rb19
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>)