clayallsopp/remote_model — pull request #2 by chrislwade (2012-06-11 03:15:42+00:00)
Title: Don't attempt to call nil.each.

It is possible to reach the ```arr_rep.each``` line in ```RemoteModule::RemoteModel.find_all``` without ```arr_rep``` being set to anything other than ```nil```. This pull request addresses that issue.

There's a similar issue in ```RemoteModule::RemoteModel.find``` but the fix would be different. If remote_model is going to be opinionated like ActiveRecord then I'd recommend checking ```response.status_code``` and just passing ```nil``` as the second argument to ```request_block_call``` in ```find``` and ```[]``` in ```find_all``` whenever it's anything other than 200 (OK). Otherwise you could use an inline ```rescue nil```.