title: Undefined method 'url_for' while rendering a Rails 2.3.x template inside a ActiveRecord model
body: <p>I know that this not an "acceptable" practice but as a background process I am caching a rendered Rails partial into the database for faster output via JSONP.  I have found many resources on the topic and successfully output a Rails 2.3.x partial within a ActiveRecord model, BUT if I use dynamic URLs within a partial Rails blows up.</p>
  
  <p>I get a successful output (minus the dynamic URLs) with this...</p>
  
  <pre><code>def self.compile_html  
  
    viewer = Class.new(ApplicationController)
    path = ActionController::Base.view_paths rescue ActionController::Base.view_root
  
    Question.all.each do |q|
    q.html = ActionView::Base.new(path, {}, viewer).render(:partial =&gt; "questions/cached_output", :locals =&gt; { :question =&gt; q })  
    sleep 1 # hold for complete output and debugging only
    q.save( false ) # bypass validations
    end
    return "Caching complete"
  end
  </code></pre>
  
  <p>I have tried including <code>ActionController::UrlWriter</code> Modules and <code>ActionView::Helpers::UrlHelper</code> with no luck.  I cannot seems to find the instantiation/inclusion order to allow the partial to access <code>ActionController::Base.new.url_for()</code> to write the dynamic routes to the partial.</p>
  
  <p>I did attempt a similar process as <a href="https://stackoverflow.com/questions/3538821/ror-undefined-method-url-for-for-nilnilclass">RoR: undefined method `url_for' for nil:NilClass</a> without luck</p>
  
  <p>I know that render_anywhere is a solution for Rails 3.x apps, but I am working in Rails 2.3.11</p>
  
  <p>Thoughts?</p>