Fix FinderMethods#last unscoped primary key

Fixes table.joins(:relation).last(N) breaking on sqlite

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/cases/finder_test.rb
Merge pull request #12196 from h-lame/fix-activesupport-cache-filestore-cleanup

Fix FileStore#cleanup to no longer rely on missing each_key method
Conflicts:
	activesupport/CHANGELOG.md
	activesupport/test/caching_test.rb
Merge pull request #12359 from arthurnn/inverse_on_callbacks

Make sure inverse_of is visible on the has_many callbacks
Conflicts:
	activerecord/CHANGELOG.md
	activerecord/test/models/company.rb
on tests: dont always touch firm on validate
Merge pull request #12364 from arthurnn/test_fix_validate

Fix query counters when testing with IdentityMap on 3.2
fix inverse_of when find_or_initialize_by_*

inverse_of relation was not being set when calling find_or_initialize_by_ and the entry was
found on the db.
Use Ruby 1.8 hash syntax
Merge pull request #12375 from arthurnn/inverse_after_find_or_initialize

Inverse after find or initialize
Move set_inverse_instance to association.build_record

[fixes #10371]
Merge pull request #12413 from arthurnn/inverse_of_on_build

Inverse of on build
make sure both headers are set before checking for ip spoofing
Merge pull request #12410 from tamird/fix-ip-spoof-errors

Fix ip spoof errors