being pedantic, but this could be a one-liner: 
```
update_attribute(:ended_at, Time.zone.now)
```