has_many :through, scoped to a value on the other side of the :through relationship

Here goes another round of wrapping my head around what rails associations are looking for. This time, I’m trying to scope a collection on the other side of a has_many :through to an attribute on that model. Contrived exhibit A: class Gym < ActiveRecord::Base # gym has a boolean "open" end class TrainerGym < ActiveRecord::Base […]