DEV Community

Discussion on: Finding an Initially Confusing Result in Rails

Collapse
 
kevin_j_m profile image
Kevin Murphy

Using tap will work as well. If you care about the return value, and you want it to be the friend without having to explicitly adding a new line to return the friend, it's a great choice.

I have a similar post on blocks in AR methods that also touches on tap available here: dev.to/thegnarco/activerecord-s-ne...