Keep if clauses side-effect free(teamten.com)
teamten.com
Keep if clauses side-effect free
https://www.teamten.com/lawrence/programming/keep-if-clauses-side-effect-free.html
https://www.teamten.com/lawrence/programming/keep-if-clauses-side-effect-free.html
```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?
```