title: How do you get the parent of a polymorphic object before its been saved?
body: <p>I have a standard polymorphic relationship and I need to know who its parent is before I save it.</p>
  
  <pre><code>Class Picture &lt; AR::Base
    belongs_to :attachable, :polymorphic =&gt; true
  end
  
  Class Person &lt; AR::Base
    has_many :pictures, :as =&gt; :attachable
  end
  
  Class Vehicle &lt; AR::Base
    has_many :pictures, :as =&gt; :attachable
  end
  </code></pre>
  
  <p>I'm uploading pictures via Paperclip and I build a processor that needs to do different things to different pictures (ie. the Person pictures should have Polaroid look &amp; the vehicle pictures should have an overlay).  My problem is that before the picture is saved I don't know if it is associated with a Person or a Vehicle.</p>
  
  <p>I tried putting a "marker" in Person &amp; Vehicle so that I could tell them appart, but when I'm in the Paperclip processor the only thing I see is the Picture class.  :(  My next thought is to climb up the stack to try and get the parent caller but that seems quite smelly to me.  How would you do it?</p>