use AR::Relation#extending! method to override query methods, much simpler

Just creating a pull request in case we need to discuss this in the future. TravisCI tests pass so will merge.

cc @norman this might be a better way to do it in FriendlyId as well, works with associations and doesn't require ugly monkeypatching. re: norman/friendly_id#452 (Doesn't seem rails/rails#13220 is going to be taken up but this works just as well.)