Comment Comment by a_w I do this often:```rubyif (user = User.find_by(email: '[email protected]')) user.update(status: 'active') end```Is it better to do this instead?```rubyuser = User.find_by(email: '[email protected]')user.update(status: 'active') if user.present?``` parent a_w 1 year ago
```ruby
if (user = User.find_by(email: '[email protected]'))
end```
Is it better to do this instead?
```ruby
user = User.find_by(email: '[email protected]')
user.update(status: 'active') if user.present?
```