```ruby
MovieViewingHistory.order('datetime_viewed DESC').limit(3)
```

Doing what you have would load all histories into memory and would be a very expensive query operation. The above will generate SQL that will only grab 3 of the most recent histories