Only merge scopes with zero arity in has_many through

with dynamic conditions.

Fixes #16128

This bug was introduced in https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d
so it's present from 4.1.2-rc1 and after.

https://github.com/rails/rails/commit/c35e438620f2d56562251571377995359546393d
merges any relation scopes passed as proc objects to the relation,
but does *not* take into account the arity of the lambda.

To reproduce: https://gist.github.com/Agis-/5f1f0d664d2cd08dfb9b
Deprecated .deliver / .deliver! to .deliver_now / .deliver_now!
Updated rdoc / guides / release notes related to ActiveJob / ActionMailer
Require ActiveJob in case a skip_xxx option is given

Change position of require active_job
Merge pull request #16585 from nicolasblanco/require_active_job

Require ActiveJob in case a skip_xxx option is given
Merge pull request #16582 from cristianbica/actionmailer-deprecate-deliver

Deprecated ActionMailer .deliver and updated ActionMailer / ActiveJob docs/guide
Fix typo in rdoc [ci skip]
Merge pull request #16586 from seuros/master

Fix typo in rdoc [ci skip]
Merge pull request #16172 from Agis-/hmt_scope_arity

has_many :through with dynamic condition merging
[Rdoc] Make clear that we are sending an AR object [ci skip]
Merge pull request #16587 from seuros/master

[Rdoc] Make clear that we are sending an AR object [ci skip]
Point release notes to stable branch for list of commits. [ci skip]
Same as f39cb2b except backport friendly

Point release notes to stable branch for list of commits. [ci skip]
Same as f39cb2b except backport friendly

Point release notes to stable branch for list of commits. [ci skip]
[ci skip] Added documentation for has_many scope parameter
Fix a few typos/some grammar in Active Job Basics
Merge pull request #16590 from loganhasson/master

[ci skip] Fix typos/grammar in Active Job guide
[ci skip] correct docs about the migration generation
Merge pull request #16592 from aditya-kapoor/fix-migration-docs

[ci skip] correct docs about the migration generation
[ci skip] add doc for STEP in migration