model.find(:all) does not return the records count, but an array with the actual records:
if you want to know how many records your got from the model object, use something like:
@records = model.find(:all)
recordCount = @records.count
@records.each do |item|
Having defined "process_record" in the model object.
hope this helps.
Thanks for the suggestion.
I typed my original code incorrectly, what I actually have is:-
@records = model.find(:count)
I tried your suggestion but it didn't resolve the problem. I thought that a sync complete notification would be a good point to do something with the records that should have been written to the local db. Do I need a db flush command or something similar??
Just to shed a bit more light on the situation, the original sync is generated by the backend and it appears to work fine as data does indeed appear on the device. The new records are not processed as the rhodes client can't see them in the code as described above.
At this point I have also tried to initiate a further sync from the web console and though I can see this sync being received on the device, the code doesn't trigger a sync complete event and my records are still left unprocessed.
I suspect that this is due to the fact that rhoconnect doesn't detect any changes between the client and backend so a sync complete notification isn't triggered.
I can initiate a manual sync from the device and interestingly this does trigger sync complete and the records are processed.
Did you try just:
@records = SomeModel.find(:all)
Then doing an inspect of `@records` to see what that returns?