everypolitician / everypolitician-popolo

Ruby gem for interacting with EveryPolitician data for a legislature
MIT License
7 stars 4 forks source link

Return a Collection from where method #106

Closed struan closed 8 years ago

struan commented 8 years ago

This changes Collection.where to return another Collection based object rather than an array. This is to allow further calls to .where and .find_by to be done on the results. This is less important for primary calls but more useful when the result is returned from methods like .terms.

Fixes #97

tmtmtmtm commented 8 years ago

I've dropped https://github.com/everypolitician/everypolitician-popolo/pull/106/commits/f3e37eb94c60affcbcaee330dd483a94b75a68ea and https://github.com/everypolitician/everypolitician-popolo/pull/106/commits/75fdf5faca9900718db3386ea7f2d8f204af9543 from this, as I'm not sure they helped much. We definitely want to simplify some of this, but I think we need to find a slightly different way to do that.

[Gah. It seems the as soon as I do that, the commits actually disappear from GitHub. I was sure those stuck around if they were still referenced…]

tmtmtmtm commented 8 years ago

@struan: now that my brain is at least a little bit more functional, https://github.com/everypolitician/everypolitician-popolo/pull/106/commits/e34f3e347201b3793e226454e3975313652ad84f seemed like the simplest improvement here.

@chrismytton as both @struan and I have been deep in this one for a while, a fresh pair of đź‘€ would be useful