Avoid relying on error messages when rescuing

When we are rescuing from an error, it's a brittle approach to do checks
with regular expressions on the raised message because it may change in
in the future and error messages are different across implementations.

The NameError API could be improved at the MRI level but for now we need
to rely on its #name. A #== check will only pass for top level constants
or only when the last constant of the path is missing so we need to rely
on #include? instead. For instance:

    begin
      Namespace::Foo
    rescue NameError => e
      e.name # => :Namespace
    end

However, if the name-space already exists, only the name of the first
missing constant in the path is returned (e.g. for Math::PHI, the name
would be :PHI). JRuby will return a fully qualified name (:"Math::PHI").

We need to keep the == check for 1.9 compatibility since const_get will
raise a NameError with a name attribute set to the given string if it's
one of "::" or "".

See http://git.io/jnSN7g for further information.
Point to rubygems instead of Rails GitHub. [ci skip]

The rails repository is not the official plugin anymore
Implement `==` on `Type::Value` and `Attribute`

This was a small self contained piece of the refactoring that I am
working on, which required these objects to be comparable.
Use *_transaction methods in TransactionManager

Use `commit_transaction`/`rollback_transaction` on
`within_new_transaction` method, so they make sure they `pop` the
transaction from the stack before calling the methods `commit`/`rollback`.
Fix regression on after_commit in nested transactions.

after_commit should not run in nested transactions, however they should
run once the outermost transaction gets committed. This patch fixes the
problem copying the records from the Savepoint to its parent. So the
RealTransaction will have all records that needs to run callbacks on it.

[fixes #16425]
Merge pull request #16435 from arthurnn/after_commit_run_on_top_level_trans_master

Fix regression on after_commit in nested transactions. (master)
Unused ivar in a test suite
Avoid polluting String class globally in a test case
Avoid mutating the constants in a test case
[ci skip] re-worded section on CookieStore to make it more readable.
Merge pull request #16523 from tomkadwill/cookie_store_rewording

[ci skip] re-worded section on CookieStore to make it more readable.
Merge pull request #16517 from sgrif/sg-comparable-attributes

Implement `==` on `Type::Value` and `Attribute`
Implement `_was` and `changes` for in-place mutations of AR attributes
Don't expose these new APIs yet (added in 877ea78 / #16189)

WARNING: don't use them! They might change or go away between future beta/RC/
patch releases!

Also added a CHANGELOG entry for this.
Merge pull request #16189 from sgrif/sg-attribute-was-in-place

Implement `_was` and `changes` for in-place mutations of AR attributes
When your templates change, browser caches bust automatically.

New default: the template digest is automatically included in your ETags.
When you call `fresh_when @post`, the digest for `posts/show.html.erb`
is mixed in so future changes to the HTML will blow HTTP caches for you.
This makes it easy to HTTP-cache many more of your actions.

If you render a different template, you can now pass the `:template`
option to include its digest instead:

  fresh_when @post, template: 'widgets/show'

Pass `template: false` to skip the lookup. To turn this off entirely, set:

  config.action_controller.etag_with_template_digest = false
Merge pull request #16527 from jeremy/etag_with_template_digest

When your templates change, browser caches bust automatically.
Merge pull request #16338 from robin850/rbx-safe-constantize

Avoid relying on error messages when rescuing