A series of commits relating to preloading and scopes caused a regression.
Cloning the relation calls initialize_copy which resets a number of instance
variables to nil. Without this the scope thinks that it is already loaded
when it is called again.
Reverts the following commits:
Fixes #6575, #6576 & #6577
This is due to a number of regressions reported in Rails:
As well as a failing test inside of api brought on by rails/rails@ac465d5.
There is also the issue of link_to_function's deprecation in this version of Rails, which is still used in a couple of places in Spree.