Я не уверен, поможет ли это вам, но
B.reflections
... даст вам хэш ассоциаций на уровне класса.Вы можете отфильтровать их.
Например:
class Datastream < ActiveRecord::Base
belongs_to :dashboard
end
Datastream.reflections
# outputs: {:dashboard=>#<ActiveRecord::Reflection::AssociationReflection:0x00000100e21ef8 @macro=:belongs_to, @name=:dashboard, @options={}, @active_record=Datastream(id: integer, dashboard_id: integer, position: integer, feed_id: string, stream_id: string, created_at: datetime, updated_at: datetime), @collection=false>}