Fix typo in set_callback docs. [ci skip]
Merge pull request #12148 from gzohari/callback-typo

Fix typo in set_callback docs. [ci skip]
Do not use instance variables if they are not reused elsewhere
Fix failure with minitest 5.0.7

Require minitest/mock in test where stub method is needed.

Apparently this was being "imported" by minitest pride plugin, which
previously required "minitest/autorun", that required "minitest/mock",
making the method available by chance.

It has been changed in minitest:
https://github.com/seattlerb/minitest/commit/595ce955c0d89575726d10fc18d2afd8f334bcbe

So we need to make sure we require what we really need where necessary.
ensure @model_class is initialized
don't depend on object state when reading fixture files
auto link hm:t fixture join tables like habtm
make the duplicate code more similar
reduce duplication somewhat
Use Ruby on Rails Coding Conventions for code examples in the guides

* Indent after private/protected
* Ruby >= 1.9 syntax for hashes
* Prefer method { do_stuff } instead of method{do_stuff} for single-line blocks.

[ci skip]
use polymorphic proxies to remove duplicate code
hm:t join tables may not have a primary key
Merge pull request #12155 from jetthoughts/reformat_guides_code_examples

Use Ruby on Rails Coding Conventions for code examples in the guides