Checking Join data for nil before accessing

So I have a join 1:0…1. If there is nothing in the child side I get an
error when I say property.pdf.name that I can’t access nil.name. But I
can’t seem to figure out how to check if pdf is nil or not before I call
the .name function. If I test for property.pdf == nil it always comes
back as nil, which it isn’t.

Any ideas?

Justin K. wrote:

So I have a join 1:0…1. If there is nothing in the child side I get an
error when I say property.pdf.name that I can’t access nil.name. But I
can’t seem to figure out how to check if pdf is nil or not before I call
the .name function. If I test for property.pdf == nil it always comes
back as nil, which it isn’t.
To check, use property.pdf.nil? rather than property.pdf == nil. I
presume the latter doesn’t work because the NoRecordException is raised
before the comparison can be made.

Alex Y. wrote:

Justin K. wrote:

So I have a join 1:0…1. If there is nothing in the child side I get an
error when I say property.pdf.name that I can’t access nil.name. But I
can’t seem to figure out how to check if pdf is nil or not before I call
the .name function. If I test for property.pdf == nil it always comes
back as nil, which it isn’t.
To check, use property.pdf.nil? rather than property.pdf == nil. I
presume the latter doesn’t work because the NoRecordException is raised
before the comparison can be made.

Thanks