Caching: fresh_when unless dev


#1

Is there any way to disable HTTP caching when in DEV?

The best I figured out for now is overriding fresh_when method like
this:

def fresh_when
super(yield) unless ENV[‘RAILS_ENV’] == ‘development’
end

and in controllers it looks:

fresh_when do
max_created_at = Time.now # for instance
{last_modified: max_created_at.utc, etag:
Digest::MD5.hexdigest(max_created_at.to_s)}
end

PS Sorry but I couldn’t find the way to define code block here