lib/spark_api/models/finders.rb in spark_api-1.3.21 vs lib/spark_api/models/finders.rb in spark_api-1.3.23
- old
+ new
@@ -6,10 +6,11 @@
def find(*arguments)
scope = arguments.slice!(0)
options = arguments.slice!(0) || {}
case scope
+ when nil then raise ArgumentError, "Argument for find() can't be nil"
when :all then find_every(options)
when :first then find_every(options).first
when :last then find_every(options).last
when :one then find_every(options.merge(:_limit => 1)).first
else find_single(scope, options)
@@ -29,14 +30,14 @@
end
private
def find_every(options)
- collect(connection.get("/#{element_name}", options))
+ collect(connection.get("#{path}", options))
end
def find_single(scope, options)
- resp = connection.get("/#{element_name}/#{scope}", options)
+ resp = connection.get("#{path}/#{scope}", options)
new(resp.first)
end
end
end