title: Rails 3: Access polymorphic_url method in separate module
body: <p>I know I can call <code>url_helpers</code> in a separate module <code>lib/utils.rb</code> like this</p>
  
  <pre><code>module Utils
    def self.get_url(object=nil)
      if object.nil?
        return Rails.application.routes.url_helpers.root_url
      else
        return Rails.application.routes.url_helpers.polymorphic_url(object)
      end
    end
  end
  </code></pre>
  
  <p>How can I access <code>polymorphic_url</code>? With this code, I get:</p>
  
  <pre><code>undefined method `polymorphic_url' for #&lt;Module:0x00000004be0128&gt;
  </code></pre>
  
  <p>I'm using Rails 3.2.</p>
  
  <p>Thanks</p>