title: How to create a url path to an unknown rails engine polymorphic record?
body: <p>I created a rails (4) application that embeds 2 isolated engines. One of the engine defines a polymorphic association that targets models in the main application and the second engine.</p>
  
  <pre><code>module Engine1
    class Engine1Model &lt; ActiveRecord::Base
      belongs_to :testable, polymorphic: true  
    end
  end
  
  module Engine2
    class Engine2Model &lt; ActiveRecord::Base
    end
  end
  
  class MainAppModel &lt; ActiveRecord::Base
  end
  </code></pre>
  
  <p>In the Engine1ModelsController views (show/index) I would like to create a link to the associated model. When you know from which domain come the record you can do that:</p>
  
  <pre><code>polymorphic_path([main_app, record1.testable])
  </code></pre>
  
  <p>or</p>
  
  <pre><code>polymorphic_path([engine2, record2.testable])
  </code></pre>
  
  <p>But here the issue is that I don't know the origin of the model. How I can create a valid url path?</p>