title: Rails Route Helper Methods included into Service Object not working properly
body: <p>I wanted to make my route helpers available in my service object.</p>
  
  <p>Ex:</p>
  
  <pre><code>blog_path(blog) #make available in service object
  </code></pre>
  
  <p>The issue is that I am using passenger, so the application is <em>relative</em> to the domain.</p>
  
  <p>Ex: Instead of the path loading: <code>www.my_domain.com/blog/1</code>, passenger loads the path with: <code>www.my_domain.com/this_app/blog/1</code>.   </p>
  
  <p>Currently my route helper in my service object is rendering the first version and not the second version.</p>
  
  <p>Here is what my service object looks like:</p>
  
  <pre><code>class BuildLink
    include ActionView::Helpers::TagHelper
    include ActionView::Helpers::UrlHelper
    RouteHelpers = Rails.application.routes.url_helpers
  
    attr_accessor :blog
  
    def initialize(blog)
      @blog = blog
    end
  
    def init
      content_tag(:li, link_to(“Show Blog“, RouteHelpers.blog_path(blog)))
    end
  end
  </code></pre>
  
  <p>The route works locally because on localhost I do not have a relative path. But when I put it in production it does not work because passenger is expecting the application name as the relative path, but the service object is not including the application name within the url it generates.  </p>
  
  <p>That relative path works everywhere else in my application, it just doesn't properly generate the relative path within the service object.</p>