Rails finders , how do you find based on children's attributes

So,

I have

class Building < ActiveRecord::Base has_many :programs end

class Program < Activerecord::Base belongs_to :building end

I want to find all Buildings that have at least one program.type == x

Is there any easy rails way to do this?

Thanks!

Jay