title: Add rails route helpers to a class as class methods
body: <p>How can i add rails route helpers like "root_path" to a class like my_model.rb as a <strong>class method</strong>?</p>
  
  <p>So my class is like this:</p>
  
  <pre><code>Class MyModel
  
    def self.foo
      return self.root_path
    end
  
  end
  
  MyModel.foo
  </code></pre>
  
  <p>The above doesn't work because Class MyModel doesn't respond to root_path</p>
  
  <p>This is what I know:</p>
  
  <ol>
  <li>I can use include <code>Rails.application.routes.url_helpers</code>, but that only add the module's methods as instance methods</li>
  <li>I tried doing extend <code>Rails.application.routes.url_helpers</code> but it <strong>didn't work</strong></li>
  </ol>
  
  <p>Please feel free to school me :)</p>