aboutsummaryrefslogtreecommitdiffstats
path: root/activeresource
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2007-05-02 23:46:31 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2007-05-02 23:46:31 +0000
commitb8e74466cce6216dc89414753bd266a66b643cfb (patch)
tree0602f8950bfdf844a2eec202bc32acb448d2384c /activeresource
parentedaf6baea72c48dc90af3cb6b0a1078228f85f89 (diff)
downloadrails-b8e74466cce6216dc89414753bd266a66b643cfb.tar.gz
rails-b8e74466cce6216dc89414753bd266a66b643cfb.tar.bz2
rails-b8e74466cce6216dc89414753bd266a66b643cfb.zip
Try the class itself if the ancestor doesnt have anything
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6653 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activeresource')
-rw-r--r--activeresource/lib/active_resource/base.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/activeresource/lib/active_resource/base.rb b/activeresource/lib/active_resource/base.rb
index 1cbbfaccf4..d2253186b0 100644
--- a/activeresource/lib/active_resource/base.rb
+++ b/activeresource/lib/active_resource/base.rb
@@ -152,7 +152,7 @@ module ActiveResource
private
# Find every resource
def find_every(options)
- case from = options.delete(:from)
+ case from = options[:from]
when Symbol
instantiate_collection(get(from, options[:params]))
when String
@@ -368,7 +368,11 @@ module ActiveResource
# FIXME: Make it generic enough to support any depth of module nesting
if (ancestors = self.class.name.split("::")).size > 1
- ancestors.first.constantize.const_get(resource_name)
+ begin
+ ancestors.first.constantize.const_get(resource_name)
+ rescue NameError
+ self.class.const_get(resource_name)
+ end
else
self.class.const_get(resource_name)
end