* Load article before creating a page view for an invalid one
This should resolve a validation error in PageView.create! when the
article does not exist (perhaps it was deleted, or the user suspended,
or it was invalid data sent from the client).
This had been happening dozens of times per day for the last 10
months.
* Use an intention revealing symbol instead of calculated id
Since we only require that find_by not find anything, pass a symbol
that's not going to be the id for any article under any conditions.
As an added benefit, this provides a clear indication of the purpose
of the symbol, without needing to mentally confirm that
```sql
SELECT * FROM articles
WHERE id IN (
SELECT (1 + MAX(id)) FROM articles
) LIMIT 1
```
actually never gives any articles back.
|
||
|---|---|---|
| .. | ||
| bust_cache_worker_spec.rb | ||
| bust_multiple_caches_worker_spec.rb | ||
| enrich_image_attributes_worker_spec.rb | ||
| score_calc_worker_spec.rb | ||
| update_page_views_worker_spec.rb | ||