Rails, Paperclip, Custom Interpolation

To allow custom interpolations in the PaperClip :path designation, add the following to your config/initializers/paperclip.rb file:

Paperclip.interpolates :custom_field do |attachment, style|
  attachment.instance.custom_field
end

 
Where :custom_field is whatever field associated with your attachment model you’d like interpolated in your path.

Leave a Reply

Your email address will not be published. Required fields are marked *