Skip to content

Resource.find doesn't work #5

Open
jamsden opened this Issue May 30, 2012 · 0 comments

1 participant

@jamsden
jamsden commented May 30, 2012

Resource.find uses method new_record? which executes a sparql count query. There seems to be a problem in federated_store.rb, method FederationManager.execute. I had to change the code to return the count from:
return results.flatten.inject{|mem,c| mem + c} if q.count?
to:
return results.flatten.size if q.count?

This may not be the correct fix, but it worked for my sample applications. What is the purpose of the inject call above, and is it missing an argument to inject. Why isn't results.size sufficient?

It seems that the results is a simple array that includes contribution from all the read adapters in the data source. So its not clear why the flatten is needed, and results.size isn't the right answer.

But in any case return results.flatten.inject{|mem,c| mem + c} doesn't return the count. Does this need to be mem += c.size or something? If results is an array of arrays, one for each data source, then it would seem this code wouldn't work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.