-
Notifications
You must be signed in to change notification settings - Fork 324
Open
Description
When I have an association and I return with nil in my API then the Her association will has a truthy value but it's clearly nil. This caused problems when I tried to use this in a condition.
I created a failing spec, you can find it here as a patch (you get the idea):
https://gist.github.com/vbalazs/87e6991347baff4d8907
so using an association in a condition gives a surprising result:
if subject
fail # shouldn't reach this
else
pass
end
As well as
subject
=> nil
subject.class
=> NilClass
subject ? 1 : 0
=> 1 # wut? :)
As a workaround, I called .nil? on it and use that way but I think it would be worth fixing it. I tried to look into it but I lost myself around the proxy objects 😕
Tested against v0.7.3.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels