Added SanitizeHelper to rails guide docs [ci skip]

Added SanitizeHelper to rails guide docs [ci skip]

Added SanitizeHelper to rails guide docs update [ci skip]
added String#to_date documentation to Rails 4 upgrade guide

[ci skip]
drop extra variable
Fix interactions between :before_add callbacks and nested attributes assignment

Issue #1: :before_add callback is called when nested attributes assignment assigns to existing record if the association is not yet loaded
Issue #2: Nested Attributes assignment does not affect the record in the association target when callback triggers loading of the association
Restore the use of `#add_to_target` for nested attribute updates on existing records, and don't bother updating the association if the update is going to be rejected anyway.

This requires adding a `skip_callbacks` argument to `#add_to_target`
so that we don't call the callbacks multiple times in this case,
which is functionally an application of existing association data,
rather than an addition of a new record to the association.
Refactor NestedAttributesWithCallbacksTest for clarity

1) Use `assert` and `refute` where possible.
2) Separately include the setup, subject, and assertions in each test - don't hide the tested call in an assertion method.
3) Name things based on their role rather than incidental facts about them - e.g. `@bird[1]` -> `bird_to_destroy`. `bird2_deletion_attributes` -> `destroy_bird_attributes`.
4) Use more succinct naming where possible - e.g. `birds_with_callback` -> `birds_with_add`, `@pirate_with_two_birds` -> `@pirate`
Merge pull request #11525 from Empact/nested_attributes_with_callbacks_bug

Improve #5476 - "Nested attributes with callbacks bugfix" to use add_to_target and clearer tests
Use assert_not rather than refute
Merge pull request #11838 from vipulnsward/drop_extra_var

drop extra variable
Added comment to a guide about necessity of `:dependent` option for associations with NOT NULL constraint
Merge pull request #11852 from prijutme4ty/guide_addition

Added comment to a guide about necessity of `:dependent` option for asso... [ci skip]
Add events reference link to the text about jquery-ujs [ci skip]
Merge pull request #11823 from fomede/add-jquery-ujs-reference-link

Add events reference link to the text about jquery-ujs [ci skip]
Use chop instead of singularize in Duration#inspect

Even though singularize tells a better story, chop is more than 50%
faster and is all that is necessary in the case of Duration#inspect, in
which all of the candidates for chopping appear in the same method and
are all singularized by removing the final 's'.

Benchmarks:

10000.times do
  1.second.inspect
end

original #inspect
   0.740000   0.000000   0.740000 (  0.739065)
   0.740000   0.000000   0.740000 (  0.741458)
   0.740000   0.010000   0.750000 (  0.744011)

refactored #inspect
   0.330000   0.000000   0.330000 (  0.333390)
   0.330000   0.000000   0.330000 (  0.331013)
   0.320000   0.000000   0.320000 (  0.330103)

10000.times do
  (1.day + 1.month + 2.minutes + 1.day).inspect
end

original #inspect
   0.790000   0.000000   0.790000 (  0.794624)
   0.770000   0.000000   0.770000 (  0.774577)
   0.770000   0.010000   0.780000 (  0.771295)

refactored #inspect
   0.390000   0.000000   0.390000 (  0.392921)
   0.400000   0.000000   0.400000 (  0.397412)
   0.370000   0.000000   0.370000 (  0.379660)
Merge pull request #11855 from dchelimsky/chop-is-faster

Use chop instead of singularize in Duration#inspect
Refactor Duration#inspect

In preparing https://github.com/rails/rails/pull/11855, it took me a
minute to understand what was going on due to naming (parts refers first
to an attr_accessor, then to a local, and is then reassigned), but also
because the iterator conditionally builds nulls and then removes them.

I refactored to something much more functional-looking that I find
easier to read, but you may or may not. If you do, great! Enjoy! If
not, oh well, I tried. Can't win 'em all :)

Rationale:

* no name conflict between local var and attr_accessor
* no reassignment of local var
* algorithm spelled out in steps
* unused items in initial list filtered out early
* empty-list case handled early instead of reassigning local var
* no duplication of formatting strings ("0 seconds")

Benchmarks (after PR #11855 merged):

10000.times do
  1.second.inspect
end

original #inspect
   0.350000   0.000000   0.350000 (  0.354709)
   0.330000   0.000000   0.330000 (  0.331885)
   0.330000   0.000000   0.330000 (  0.334441)

refactored #inspect
   0.340000   0.000000   0.340000 (  0.340080)
   0.340000   0.010000   0.350000 (  0.345069)
   0.330000   0.000000   0.330000 (  0.335873)

10000.times do
  (1.day + 1.month + 2.minutes + 1.day).inspect
end

original #inspect
   0.400000   0.000000   0.400000 (  0.403027)
   0.400000   0.000000   0.400000 (  0.403781)
   0.390000   0.000000   0.390000 (  0.387596)

refactored #inspect
   0.400000   0.010000   0.410000 (  0.399792)
   0.400000   0.000000   0.400000 (  0.404145)
   0.400000   0.000000   0.400000 (  0.403820)
Merge pull request #11856 from dchelimsky/refactor-duration-inspect

Refactor Duration#inspect
defines a new :abort deprecation behaviour that raises

See the CHANGELONG message in the patch for further details.
fixes typo in CHANGELOG
renames the :abort deprecation behaviour to :raise

That is a better name, thanks @jeremy.