Update Active Record's attribute query methods documentation to describe its full behaviour. [ci skip]
Clarify that the word present refers to Object#present?. [ci skip]

Update Active Record's attribute query methods documentation to clarify that whether an attribute is present is based on Object#present?. This gives people a place to go see what the exact definition of presence is. [ci skip]
Remove unneeded special case to calculate size for has_many :through

All cases are properly handled in CollectionAssociation
for all subclasses of this association
Merge pull request #18174 from bogdan/cleanup_has_many_though_association_count

Remove unneeded special case to calculate size for has_many :through
proof of concept, need to check in GitHub
second test to warn against reading guides in GitHub
third test to warn against reading guides in GitHub
warn about reading guides in GitHub

References #18148.
removes superfluous regexp group
Clarify that query methods have a custom definition of whether a numeric value is present. [ci skip]

The way Active Record query methods handle numeric values is a special case, and is not part of Rails's standard definition of present. This update attempts to make this more clear in the docs, so that people don't expect Object#present? to return false if used on a number that is zero.
Merge pull request #18159 from M7/docs-active_record-update_query_method_docs_with_full_description

Describe full behaviour of Active Record's attribute query methods
Throw :abort halts default CallbackChains

This commit changes arguments and default value of CallbackChain's :terminator
option.

After this commit, Chains of callbacks defined **without** an explicit
`:terminator` option will be halted as soon as a `before_` callback throws
`:abort`.

Chains of callbacks defined **with** a `:terminator` option will maintain their
existing behavior of halting as soon as a `before_` callback matches the
terminator's expectation. For instance, ActiveModel's callbacks will still
halt the chain when a `before_` callback returns `false`.
Deprecate `false` as the way to halt AS callbacks

After this commit, returning `false` in a callback will display a deprecation
warning to make developers aware of the fact that they need to explicitly
`throw(:abort)` if their intention is to halt a callback chain.

This commit also patches a single use of AS::Callbacks inside `railties`,
changing its result from `false` to `nil` (equivalent for the purpose of
that method), so the deprecation warning does not show up in that case.
Deprecate `false` as the way to halt AM validation callbacks

Before this commit, returning `false` in an ActiveModel validation
callback such as `before_validation` would halt the callback chain.

After this commit, the behavior is deprecated: will still work until
the next release of Rails but will also display a deprecation warning.

The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
Deprecate `false` as the way to halt AM callbacks

Before this commit, returning `false` in an ActiveModel `before_` callback
such as `before_create` would halt the callback chain.

After this commit, the behavior is deprecated: will still work until
the next release of Rails but will also display a deprecation warning.

The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
Deprecate `false` as the way to halt AR callbacks

Before this commit, returning `false` in an ActiveRecord `before_` callback
such as `before_create` would halt the callback chain.

After this commit, the behavior is deprecated: will still work until
the next release of Rails but will also display a deprecation warning.

The preferred way to halt a callback chain is to explicitly `throw(:abort)`.
Add config to halt callback chain on return false

This stems from [a comment](rails#17227 (comment)) by @dhh.
In summary:

* New Rails 5.0 apps will not accept `return false` as a way to halt callback chains, and will not display a deprecation warning.
* Existing apps ported to Rails 5.0 will still accept `return false` as a way to halt callback chains, albeit with a deprecation warning.

For this purpose, this commit introduces a Rails configuration option:

```ruby
config.active_support.halt_callback_chains_on_return_false
```

For new Rails 5.0 apps, this option will be set to `false` by a new initializer
`config/initializers/callback_terminator.rb`:

```ruby
Rails.application.config.active_support.halt_callback_chains_on_return_false = false
```

For existing apps ported to Rails 5.0, the initializers above will not exist,
and the option defaults to `true`. Therefore, existing apps will still accept
`return true` as a way to halt callback chains, displaying a deprecation warning.
Developers will be able to switch to the new behavior (and stop the warning)
by manually adding the line above to their `config/application.rb`.