From b8e74466cce6216dc89414753bd266a66b643cfb Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Wed, 2 May 2007 23:46:31 +0000 Subject: 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 --- activeresource/lib/active_resource/base.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'activeresource') 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 -- cgit v1.2.3