Предупреждение об устаревании при использовании has_many: through: uniq в Rails 4

В Rails 4 появилось предупреждение об устаревании при использовании: uniq => true с has_many: through. Например:

has_many :donors, :through => :donations, :uniq => true

Выдает следующее предупреждение:

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'

Как правильно переписать вышеупомянутое объявление has_many?

Ответы на вопрос(2)

Ваш ответ на вопрос