tapioca
tapioca copied to clipboard
Are there any plans to support ActiveRecord `.find_by_xxx`?
If I understand correctly, I think it is currently as follows
# NG
Article.find_by_id(target_id) # -> error: find_by_id not found
# OK
Article.find_by(id: target_id) # -> no error
I would like Tapioca to support the generation of .find_by_xxx.
Do you have plans to do so?
I think they are implemented here. We know the attribute names so we could do it in ActiveModelAttributes compiler. But I don't know why they aren't defined together with the attributes themselves, maybe there's a potential blocker there, cc @paracycle.
@KaanOzkan Thank you for sharing the details.
I guessed that generating the type for the .find_by_x method would affect the performance of the type checking because of the large size of the RBI definition.