You could collapse this into one condition using Rails' ```try``` method. For comparison:

```
if @user.try(:authenticate. params[:password]))
```