title: How do I pass a variable watermark path to a paperclip watermark processor?
body: <p>I have watermarks, galleries, and photos models.</p>
  
  <p>Gallery <code>belongs_to</code> Watermark
  Photo <code>belongs_to</code> Gallery</p>
  
  <pre><code>class Photo &lt; ActiveRecord::Base
    before_save :save_dimensions, :set_orientation
    belongs_to :gallery
  
    has_attached_file :image,
      :processors =&gt; [:watermark],
      :styles =&gt; {
        :thumbnail =&gt; ["80x80&gt;"],
        :small =&gt; {
          :geometry =&gt; "200x200&gt;",
          :watermark_path =&gt; "#{gallery.watermark.image.path(:small)}",
          :position =&gt; "Center"
        },
        :medium =&gt; {
          :geometry =&gt; "400x400&gt;",
          :watermark_path =&gt; "#{gallery.watermark.image.path(:medium)}",
          :position =&gt; "Center"
        },
        :large =&gt; {
          :geometry =&gt; "600x600&gt;",
          :watermark_path =&gt; "#{gallery.watermark.image.path(:large)}",
          :position =&gt; "Center"
        }
      },
      :path =&gt; ":rails_root/public/images/galleries/:gallery_id/:id/:style_:basename.:extension",
      :url =&gt; "galleries/:gallery_id/:id/:style_:basename.:extension"
    validates_attachment_presence :image
    validates_attachment_content_type :image, :content_type =&gt; ['image/jpeg', 'image/png']
    attr_protected :image_file_name, :image_content_type, :image_file_size
  
  end
  </code></pre>
  
  <p>With this I get <code>undefined local variable or method 'gallery'</code>. If I try like this with <code>:gallery_watermark_path</code> defined using Paperclip.interpolations it silently fails.</p>
  
  <pre><code>:watermark_path =&gt; ":gallery_watermark_path"
  </code></pre>
  
  <p>The <code>:gallery_watermark_path</code> doesn't get processed by Paperclip.interpolations:</p>
  
  <p>development.log:</p>
  
  <pre><code>[paperclip] identify -format %wx%h '/tmp/stream20110620-30644-1j6i9in.jpg[0]' 2&gt;/dev/null
  [paperclip] convert '/tmp/stream20110620-30644-1j6i9in.jpg' '-resize' '80x80&gt;' '-auto-orient' '/tmp/stream20110620-30644-1j6i9in20110620-30644-1mcqvox' 2&gt;/dev/null
  [paperclip] identify -format %wx%h '/tmp/stream20110620-30644-1j6i9in.jpg[0]' 2&gt;/dev/null
  [paperclip] convert '/tmp/stream20110620-30644-1j6i9in.jpg' '-resize' '200x200&gt;' '-auto-orient' '/tmp/stream20110620-30644-1j6i9in20110620-30644-60zlb' 2&gt;/dev/null
  [paperclip] composite '-gravity' 'Center' ':gallery_watermark_path' '/tmp/stream20110620-30644-1j6i9in20110620-30644-60zlb' '/tmp/stream20110620-30644-1j6i9in20110620-30644-60zlb' 2&gt;/dev/null
  [paperclip] An error was received while processing: #&lt;Paperclip::PaperclipError: There was an error processing the watermark for stream20110620-30644-1j6i9in&gt;
  [paperclip] identify -format %wx%h '/tmp/stream20110620-30644-1j6i9in.jpg[0]' 2&gt;/dev/null
  [paperclip] convert '/tmp/stream20110620-30644-1j6i9in.jpg' '-resize' '400x400&gt;' '-auto-orient' '/tmp/stream20110620-30644-1j6i9in20110620-30644-1ronidq' 2&gt;/dev/null
  [paperclip] identify -format %wx%h '/tmp/stream20110620-30644-1j6i9in.jpg[0]' 2&gt;/dev/null
  [paperclip] convert '/tmp/stream20110620-30644-1j6i9in.jpg' '-resize' '600x600&gt;' '-auto-orient' '/tmp/stream20110620-30644-1j6i9in20110620-30644-1ikfy72' 2&gt;/dev/null
  </code></pre>
  
  <p>In short, how do I pass the watermark variable to the processor?</p>