Method: ActionController::Caching::Fragments#write_fragment

Defined in:
actionpack/lib/action_controller/caching/fragments.rb

#write_fragment(key, content, options = nil) ⇒ Object

Writes content to the location signified by key (see expire_fragment for acceptable formats).



27
28
29
30
31
32
33
34
35
36
# File 'actionpack/lib/action_controller/caching/fragments.rb', line 27

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

  key = fragment_cache_key(key)
  instrument_fragment_cache :write_fragment, key do
    content = content.to_str
    cache_store.write(key, content, options)
  end
  content
end