Fix `attributes_before_type_cast` for serialised attributes.

Public method `attributes_before_type_cast` used to return internal AR structure (ActiveRecord::AttributeMethods::Serialization::Attribute), patch fixes this. Now behaves like `read_attribute_before_type_cast` and returns unserialised values.
Merge pull request #8078 from nikitug/serialized_attributes_before_type_cast

Fix `attributes_before_type_cast` for serialized attributes.
if format is unknown NullMimeTypeObject is returned

If a unknown format is passed in a request, the methods html?, xml?, json? ...etc
Nil Exception.

This patch add a class NullMimeTypeObject, that is returned when  request.format is unknown
and it responds false to the methods that ends with '?'.

It refers to #7837, not fixes because it's not considered a improvement not a bug.
Merge pull request #8084 from acapilleri/format_never_nil

if format is unknown NullMimeTypeObject is returned
Fix find_in_batches against string IDs when start option is not specified.
Merge pull request #8073 from alexisbernard/fix_find_in_batches_start_option

Fix find_in_batches against string IDs when start option is not specified
Remove extre count, preheat already happens during setup
Revert "if format is unknown NullMimeTypeObject is returned"

This reverts commit a8560fa361958b33d76e4468eb5c07d82a20196e.
Allow #permit to take its list of permitted parameters as an array
No need for the debugger
Revert "Don't allocate new strings in compiled attribute methods"

This reverts commit f1765019ce9b6292f2264b4601dad5daaffe3a89.
Make sure that RAILS_ENV is set when accessing Rails.env

Fixes #8025
Merge pull request #8026 from steveklabnik/issue_8025

Make sure that RAILS_ENV is set when accessing Rails.env
Small change to remove warning unused variable.
Merge pull request #8092 from arunagw/warning_removed_unused_var

Small change to remove warning unused variable.
Add test to ensure data attributes are properly escaped with tag helpers

Closes #8091
Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header, now appends).

Now `BestStandardsSupport` middleware appends it's `X-UA-Compatible` value to app's value.
Also test for `BestStandardsSupport` middleware added.
Merge pull request #8093 from nikitug/keep_app_x_ua_compatible

Fix #8086 (BestStandardsSupport rewrites app X-UA-Compatible header)
Fix issue with collection associations and first(n)/last(n)

When calling first(n) or last(n) in a collection, Active Record was
improperly trying to set the inverse of instance in case that option
existed. This change was introduced by
fdf4eae506fa9895e831f569bed3c4aa6a999a22.

In such cases we don't need to do that "manually", since the way
collection will be loaded will already handle that, so we just skip
setting the inverse association when any argument is given to
first(n)/last(n).

The test included ensures that these scenarios will have the inverse of
instance set properly.

Fixes #8087, Closes #8094.

Squashed cherry-pick from d37d40b and c368b66.

Conflicts:
	activerecord/CHANGELOG.md
	activerecord/lib/active_record/associations/collection_association.rb
memoize calculated ip without additional variable

There is no need in additional `@calculated_ip` instance variable.