Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 6653

Show
Ignore:
Timestamp:
05/02/07 23:46:31 (1 year ago)
Author:
david
Message:

Try the class itself if the ancestor doesnt have anything

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activeresource/lib/active_resource/base.rb

    r6646 r6653  
    153153        # Find every resource 
    154154        def find_every(options) 
    155           case from = options.delete(:from) 
     155          case from = options[:from] 
    156156          when Symbol 
    157157            instantiate_collection(get(from, options[:params])) 
     
    369369        # FIXME: Make it generic enough to support any depth of module nesting 
    370370        if (ancestors = self.class.name.split("::")).size > 1 
    371           ancestors.first.constantize.const_get(resource_name) 
     371          begin 
     372            ancestors.first.constantize.const_get(resource_name) 
     373          rescue NameError 
     374            self.class.const_get(resource_name) 
     375          end 
    372376        else 
    373377          self.class.const_get(resource_name)