Closed ksss closed 3 years ago
I'm wondering if RBS Rails should be aware of optional: true
option of belongs_to
. If belongs_to
doesn't receive optional: true
, RBS Rails can assume the association is not nil-able.
Your change for has_one
looks good.
By the way, I'm planning to make the optionality more accurate. In short, User.new
and User.find
should return different types, because the former's attributes are nil-able but the latter's attributes aren't.
User.new and User.find should return different types
Sounds great!
I agree with you.
In this PR, I will only change has_one
.
Updated.
Thanks for your update! Looks good to me :+1:
has_one
can benil
when none associated record. Andbelongs_to
can benil
when associated id isnil
. This change will help to find nilable object in model code.