I have built a Rails app that has data about the US Congress. I have a Legislator model and a Bill model:
class Legislator < ActiveRecord::Base
has_many :bills
end
class Bill < ActiveRecord::Base
belongs_to :legislator
end
So bills that a legislator has sponsored are tied to that legislator. The legislator also has a "party" attribute that is either "R", "D", or "I"
I want to get a list of all bills that were sponsored by all legislators from a particular party, e.g., all bills that were sponsored by Democrat. What would this query look like?