lib/sugarcrm/base.rb in sugarcrm-0.9.5 vs lib/sugarcrm/base.rb in sugarcrm-0.9.6
- old
+ new
@@ -36,12 +36,20 @@
def find(*args)
options = args.extract_options!
validate_find_options(options)
case args.first
- when :first then find_initial(options)
- when :all then Array.wrap(find_every(options))
- else find_from_ids(args, options)
+ when :first
+ find_initial(options)
+ when :all
+ results = find_every(options)
+ if results
+ Array.wrap(results)
+ else
+ []
+ end
+ else
+ find_from_ids(args, options)
end
end
# A convenience wrapper for <tt>find(:first, *args)</tt>. You can pass in all the
# same arguments to this method as you can to <tt>find(:first)</tt>.
\ No newline at end of file