I'm trying to build an array using inject. I expect consents to be an array of ParticipantConsent objects.
Each ParticipantConsent object can :have_many ParticipantConsentSample objects.
I expect sc to contain an array of arrays of ParticipantConsentSample objects associated with every ParticipantConsent object associated with a Participant.
consents = ParticipantConsent.where(:participant_id => @participant.id).all
sample_consents = consents.inject { |sc, c| sc << ParticipantConsentSample.where(:participant_consent_id => c.id).all }
Currently getting back the contents of consents when I check the contents of sample_consents. Where am I going wrong? Thanks.