mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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
This commit is contained in:
parent
edaf6baea7
commit
b8e74466cc
1 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue