lib/api_resource/finders.rb in api_resource-0.6.23 vs lib/api_resource/finders.rb in api_resource-0.6.24

- old
+ new

@@ -34,18 +34,17 @@ # TODO: Make this into a class attribute properly (if it isn't already) # this is a little bit of a hack because options can sometimes be a Condition expiry = @expiry ApiResource.with_ttl(expiry.to_f) do if numeric_find - if single_find && (@conditions.blank_conditions? || nested_find_only?) + if (single_find || empty_find) && (@conditions.blank_conditions? || nested_find_only?) # If we have no conditions or they are only prefixes or # includes, and only one argument (not a word) then we # only have a single item to find. # e.g. Class.includes(:association).find(1) # Class.find(1) final_cond = @conditions.merge!(ApiResource::Conditions::ScopeCondition.new({:id => @scope}, self)) - ApiResource::Finders::SingleFinder.new(self, final_cond).load else # e.g. Class.scope(1).find(1) # Class.includes(:association).find(1,2) # Class.find(1,2) @@ -126,9 +125,13 @@ when :all :all_records else :number end + end + + def empty_find + arg_ary == :none end def numeric_find arg_type == :number end \ No newline at end of file