Using ActiveSupport::Concern instead of plain regular Ruby hooks in rail...

This is the new PR for the https://github.com/rails/rails/pull/10547 which was closed and submitted this new pull request because I have a mess of it...