This project is archived and is in readonly mode.

#4449 ✓invalid

render :file caches contents - doesn't reload until webserver reloaded

Reported by subimage | April 21st, 2010 @ 04:16 PM | in 2.3.6

Ran into this issue when upgrading a 2.1.2 app to 2.3.5.

I had a controller that was using render :file to show a CSS document.

In 2.1.2 I could edit that document, reload, and see the changes that happened. Under 2.3.5 the same code refuses to reload the document unless Rails/passenger is restarted. I was forced to use "render :text =>" instead of render :file.

The new behavior is confusing.

Comments and changes to this ticket

  • Rizwan Reza

    Rizwan Reza May 15th, 2010 @ 03:52 PM

    • Milestone set to 2.3.6
    • Tag changed from cache, caching, file, render to bugmash, cache, caching, file, render
  • Diego Algorta

    Diego Algorta May 15th, 2010 @ 06:25 PM

    • Tag changed from bugmash, cache, caching, file, render to bugmash, cache, caching, file, not, render

    not reproducible

    I tried with 2-3-stable branch and I was able to update my template file and see the changes in the browser without needing to restart the app.

  • Rizwan Reza

    Rizwan Reza May 15th, 2010 @ 06:26 PM

    • State changed from “new” to “invalid”
  • Aaron Hamid

    Aaron Hamid May 15th, 2010 @ 09:18 PM

    Diego, was it a file with a .css extension?

  • Aaron Hamid
  • Rizwan Reza

    Rizwan Reza May 16th, 2010 @ 02:07 AM

    • Tag changed from bugmash, cache, caching, file, not, render to cache, caching, file, not, render
  • heldopslippers

    heldopslippers June 22nd, 2010 @ 03:30 PM

    It is reproducible.
    I have te same problem. Running in development mode. And rendering a css file. When changing the file rails does not pick up on it.

    I have to say though that I am using it with an action (for very good reasons).

    so for example I have this line of code in my application controller:

    def css
      render :file => "#{RAILS_ROOT}/clients/#{client_id}/index.css", :layout => false

    I am by the way running v 2.3.8
    And really don't know if this helps (first time) But I hope it does!

  • dxg

    dxg September 24th, 2010 @ 06:28 AM

    • Importance changed from “” to “Low”

    Have exactly the same problem.
    Rails 2.3.9, ruby 1.9.1p429, i686-linux, development mode, using 'script/server'

    <%= render :file => Rails.root.to_s + '/app/views/ab_mailer/newsletter.html.erb' %>
  • Damon Cali

    Damon Cali November 3rd, 2010 @ 03:36 PM

    Same problem.

    Rails 2.3.5, Ruby 1.8.7-p302, Snow Leopard, development env, WEBrick 1.3.1

  • obregoru

    obregoru December 16th, 2010 @ 06:05 PM

    I have this same problem - to get around it, I'm currently using the render :text => as recommend above, but this method but this is much slower in terms of performance.

    I have html files in /public which has content that is changed regularly. I would like to be able to have the file cached, yet, be able to update or invalidate the cache on a timed/regular basis so that the file reloads and is rendered via render :file..

    Using file open along with my own cache of file contents may work well in the short run, but really - what is the answer here??

  • Paintrick

    Paintrick February 25th, 2011 @ 12:32 PM

    I have the same issue in 3.0.4..
    could it be a proxy cache or something
    or is it really Rails caching the render :file part?

    Also, when I open the rendered file in another browser tab
    but then without rails, I see the latest content.

    how does this work / happen?

  • tsailipu

    tsailipu March 25th, 2011 @ 08:45 PM

    Same in 3.0.5. I do know that this behavior doesn't happen in development mode and only on production mode.... Is there a way for us to clear in the code whatever is being cached?

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>