Comment

Comment by a_w

I do this often:

```ruby

if (user = User.find_by(email: '[email protected]'))

  user.update(status: 'active')
end

```

Is it better to do this instead?

```ruby

user = User.find_by(email: '[email protected]')

user.update(status: 'active') if user.present?

```

parent a_w 1 year 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