Patient.joins(:notes,:recordings).find(1)
반환하기 때문에 어떤 문제없이 작동하고 ID를 가진 환자의 레코드를 검색 Patient.find(1)
같은 콘솔에서 기괴한
ActiveRecord::RecordNotFound: Couldn't find Patient with id=1
1.
내 이해는 내가 할 수 있어야한다는 것입니다 :
a = Patient.joins(:notes,:recordings).find(1)
a.notes
a.recordings
그리고 a.notes는 a.recordings와 동일하게 id가 1 인 환자와 관련된 모든 메모를 반환해야합니다. 내가 여기서 뭔가를 놓치고있는 것이 분명해 ... 어떤 생각?
find find (1) to first? – Phlip
id가 존재하지 않으면 오류를 던지기보다 빈 연결을 반환 할 수있는 방법이 있습니까? – Morgan
Nvm; 그것을 해결했습니다. – Morgan