everypolitician / everypolitician-popolo

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

Collection.where returns an array and not a collection #97

Closed struan closed 8 years ago

struan commented 8 years ago

Problem

Because of the underlying implementation where returns an Array which means that things build on top of it such as legislative_periods return an Array so you can't do things like:

Everypolitician::Popolo.read(filename).legislative_periods.find_by(id: 'term/13')

as there is no find_by method on Array.

Proposed Solution

Change where to return a Collection.

Acceptance Criteria

This code works:

Everypolitician::Popolo.read(filename).legislative_periods.find_by(id: 'term/13')

Not Required

Prerequisites

Related Issues