caching: fresh_when unless dev

7 views
Skip to first unread message

Igor Abramov

unread,
Dec 25, 2014, 11:46:14 AM12/25/14
to rubyonra...@googlegroups.com
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

--
Posted via http://www.ruby-forum.com/.
Reply all
Reply to author
Forward
0 new messages