Rails 4 a introduit un avertissement de désapprobation lors de l'utilisation de: uniq => true avec has_many: through. Par exemple:
has_many :donors, :through => :donations, :uniq => true
Donne l'avertissement suivant:
DEPRECATION WARNING: The following options in your Goal.has_many :donors declaration are deprecated: :uniq. Please use a scope block instead. For example, the following:
has_many :spam_comments, conditions: { spam: true }, class_name: 'Comment'
should be rewritten as the following:
has_many :spam_comments, -> { where spam: true }, class_name: 'Comment'
Quelle est la bonne façon de réécrire la déclaration has_many ci-dessus?