モデル (この場合は Participant モデル) のメソッドを作成して、関連付けの特定のセットを調べ、関連付けが存在するかどうかを単に記録したいと考えています。ここに私が持っているものがあります:
def post_screener_associations?
ParticipantAuthorizationForm.where(:participant_id => self.id).count > 0
ParticipantConsent.where(:participant_id => self.id).count > 0
# and so on exactly like the format above about 8 more times!
end
このクエリを作成するためのより良い方法があることは知っていますが、同僚に迷惑をかけたくありません。ありがとう。