Sam
a7628c1d74
FIX: use ordered_posts for last post check, not the posts relation
...
The `posts` relation on `Topic` is not ordered. Using `Topic.posts.first`
is basically the same as asking for a random post, it will depend on DB
order. This breaks on Topic merge and split for example.
Additionally, a huge problem with that is that it forces active record down
a slow path. `Topic.posts.first` is extremely slow on giant topics, since
it has no default ordering it appears AR materializes the entire set prior
to doing `first`.
This commit also illustrates the importance of testing, initially I only
fixed the second instance of the problem in `post_validator.rb` but testing
revealed that the problem was repeated at the top of the file.
Longer term we should consider a larger change of default ordering the posts
relations so people do not fall down this trap anymore.
2019-01-18 13:18:40 +11:00
..
2019-01-15 12:52:45 +08:00
2018-12-11 09:58:20 +00:00
2017-07-28 10:20:09 +09:00
2018-09-13 14:26:30 +05:30
2018-12-18 16:12:05 +01:00
2019-01-16 15:01:50 -05:00
2018-10-01 17:14:36 +02:00
2018-12-18 13:38:25 +08:00
2017-07-28 10:20:09 +09:00
2017-07-28 10:20:09 +09:00
2018-09-14 15:40:20 -04:00
2018-11-19 14:50:00 +01:00
2018-02-14 10:40:46 +11:00
2018-12-04 11:48:13 +08:00
2018-06-19 07:48:03 +08:00
2018-11-19 16:21:39 +11:00
2018-08-29 12:36:59 +10:00
2019-01-16 10:29:36 +08:00
2018-11-23 16:11:05 +01:00
2018-11-29 19:12:00 -05:00
2018-11-28 17:32:19 +01:00
2019-01-18 13:18:40 +11:00
2018-12-19 10:20:48 +01:00
2017-07-28 10:20:09 +09:00
2018-05-17 08:47:24 +08:00
2017-07-28 10:20:09 +09:00
2018-08-23 14:41:06 +05:30
2018-05-03 15:41:41 +02:00
2018-06-28 18:15:07 +10:00
2018-10-04 13:21:37 +08:00
2017-07-28 10:20:09 +09:00
2019-01-17 13:24:32 +11:00
2018-06-21 10:56:46 +10:00
2017-02-07 09:22:16 -05:00
2015-12-01 20:39:42 +00:00
2018-01-30 08:54:37 +11:00
2017-07-28 10:20:09 +09:00
2018-10-15 15:06:02 -04:00
2018-10-01 17:14:36 +02:00
2018-08-06 09:25:48 +01:00
2016-09-05 19:33:03 +08:00
2019-01-02 16:33:50 +08:00
2018-12-18 11:56:25 +08:00
2018-10-15 14:48:45 +08:00
2017-11-21 17:10:04 +08:00
2015-12-01 20:39:42 +00:00
2018-09-19 15:50:58 +10:00
2017-12-06 01:47:51 +01:00
2017-10-04 11:41:25 -04:00
2017-07-28 10:20:09 +09:00
2018-03-12 16:55:23 +01:00
2018-01-25 14:57:41 +01:00
2017-12-06 10:45:09 +11:00
2017-12-06 10:45:09 +11:00
2018-09-13 15:43:58 +08:00
2017-07-28 10:20:09 +09:00
2018-12-19 12:34:47 +05:30
2019-01-04 13:16:44 -05:00
2017-10-19 13:55:23 -04:00
2017-07-28 10:20:09 +09:00
2018-10-24 15:14:01 +11:00
2018-12-05 16:43:07 +01:00
2016-05-05 18:47:08 +05:30
2018-10-16 10:46:55 +11:00
2017-03-13 10:02:20 -04:00
2018-12-18 11:40:54 +01:00
2018-12-03 10:19:49 -05:00
2018-11-13 16:52:08 +05:30
2018-12-04 10:48:16 +01:00
2017-07-28 10:20:09 +09:00
2015-12-01 20:39:42 +00:00
2018-02-28 10:45:11 +11:00
2018-11-09 18:24:28 +01:00
2015-12-01 20:39:42 +00:00
2018-10-10 18:39:03 +08:00
2017-07-28 10:20:09 +09:00
2017-07-28 10:20:09 +09:00
2017-07-28 10:20:09 +09:00
2017-12-06 01:47:51 +01:00
2017-07-28 10:20:09 +09:00
2019-01-08 15:22:22 +08:00
2018-11-29 22:44:18 +05:30
2015-12-01 20:39:42 +00:00
2018-01-26 14:01:30 -05:00
2017-10-02 11:34:57 +08:00
2018-12-03 14:14:59 +11:00
2018-12-25 17:02:28 +02:00
2018-09-19 12:53:36 -07:00
2018-03-13 13:41:06 -04:00
2018-03-01 13:20:42 +08:00
2015-12-01 20:39:42 +00:00
2018-01-29 15:40:12 +11:00
2017-07-07 15:09:14 +09:00
2018-09-17 10:57:50 +10:00
2018-07-05 15:34:58 +10:00
2019-01-14 15:00:45 +05:30
2016-12-19 18:00:22 +11:00
2019-01-16 10:29:36 +08:00
2018-04-18 11:32:32 +05:30
2017-07-07 15:09:14 +09:00
2017-07-28 10:20:09 +09:00
2017-07-28 10:20:09 +09:00
2017-07-28 10:20:09 +09:00
2018-11-20 09:12:32 +01:00
2018-02-01 13:25:29 +05:30
2018-12-21 11:03:58 +02:00
2018-08-03 16:41:37 -04:00
2018-06-27 11:41:35 +08:00
2018-08-27 14:50:56 +10:00
2018-03-26 16:06:20 -04:00
2018-12-07 12:44:23 +00:00
2017-07-28 10:20:09 +09:00
2018-12-13 13:57:05 +11:00
2017-09-28 14:22:49 +02:00
2017-07-28 10:20:09 +09:00
2016-01-08 20:43:11 +05:30
2017-07-28 10:20:09 +09:00
2018-12-11 18:03:13 +11:00
2018-09-10 22:17:56 +05:30
2017-07-28 10:20:09 +09:00