Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

write_fragment should return content when caching is disabled

#846

     def write_fragment(key, content, options = nil)
         return unless cache_configured?

         key = fragment_cache_key(key)

         self.class.benchmark "Cached fragment miss: #{key}" do
           cache_store.write(key, content, options)
         end

         content
      end

line 2 should be return content unless cache_configured? Otherwise something like this render :json => write_fragment(key, some json data) will receive a nil value for render and look for an action.json.erb file instead of returning the non-cached value of content

Reported by Brian Johnson · August 16th, 2008 @ 05:48 PM

State: resolved
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Brian Johnson
    Brian Johnson

    sorry about the formatting, but no way to fix it now

    August 16th, 2008 @ 05:49 PM

  2. josh
    josh
    • State changed from new to open

    November 22nd, 2008 @ 07:16 PM

  3. Repository
    Repository
    • State changed from open to resolved

    (from [20d6fdd2567b44fc7de9768a6dedd50d2ea9c4ce]) write_fragment returns content if caching is disabled [#846 write_fragment should return content when caching is disabled state:resolved] http://github.com/rails/rails/co...

    November 22nd, 2008 @ 07:22 PM