thoughtbot/paperclip — pull request #1025 by urbanautomaton (2012-09-19 15:19:24+00:00)
Title: Check attachment paths for duplicates, not URLs

Hi all,

As per comments in #588, #589 and #660, attachments using certain interpolations for the attachment URL were mistakenly being flagged as being duplicates, even though the interpolation expands to a unique location for each model.

This commit (partially) addresses the issue by checking the attachment path instead, as suggested in #588. This fixes what is probably the most common affected scenario, attachments using S3 storage, and thus the `:s3_alias_url` interpolation (or similar).

However, the problem will remain for users who use interpolations other than :class to distinguish attachment paths for different models. Without expanding all path interpolations, the checker can't tell whether they're truly unique for each model or not. Therefore this approach is always going to potentially generate false positives. It's not clear to me how best to address this (and I'm not sure how many users will really be affected), so I'm submitting this patch in the interim.

Cheers,
Simon