Commit Graph

4 Commits

Author SHA1 Message Date
Javi Martín
69dda19af7 Add and apply Rails/PluckId rubocop rule 2021-08-09 23:52:47 +02:00
Javi Martín
74088ac949 Make random IDs with the same seed consistent
The order of the array before being shuffled needs to be the same if we
want to have the same array after being shuffled with a certain seed.

We were using `pluck(:id)`, which doesn't guarantee the order of the
elements returned.

Replacing it with `order(:id).pluck(:id)` adds an `ORDER BY` clause and
so guarantees the order of the elements.
2019-04-03 21:21:11 +02:00
Javi Martín
6682121069 Reuse code to set and order by a random seed 2019-02-20 12:10:12 +01:00
Javi Martín
e3ca700e17 Add concerns to set and order by a random seed 2019-02-20 11:51:32 +01:00