Ruby on Rails Thursday, December 25, 2014

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/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/277f18ff9473337dc01985b4661045fe%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment