4 ms·
I do this often: ```ruby if (user = User.find_by(email: 'abc@example.com')) user.update(status: 'active') end ``` Is it better to do this instead? ```r
by a_w 1y ago
I do this often:
```ruby
if (user = User.find_by(email: 'abc@example.com'))
user.update(status: 'active')
end
```
Is it better to do this instead?
```ruby
user = User.find_by(email: 'abc@example.com')
user.update(status: 'active') if user.present?
```