Comment

Comment by bnorton

Instead of assigning a variable or bloating the length of your statements, use this method to to return the caller and only execute the block if the condition passes.

User.where(:email => email).first.tap_if(:present?) {|user| user.send_update }

parent bnorton 13 years ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton