Revert "Workaround for Rails 5, where LIMIT..."
This reverts commit 6823e7de.
Originally implemented in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21839, but an error was reported in https://gitlab.com/gitlab-org/gitlab-ce/issues/51729 resulting in a workaround introduced in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/21879.
Now Rails 5.2 is used, this workaround no longer seems needed, so this reverts it.