Posts

Take Control of Your HTTP Caching in Rails

This post was originally published on the thoughtbot blog.

The Rails fresh_when method is a powerful tool for conditionally caching resources via HTTP. However there are some pitfalls. For one, fresh_when only supports the default render flow in a controller; if a client’s cache is not fresh, it will just render the related view. We cannot utilize things like render json:.

Fortunately, Rails provides us with more tools to work with HTTP conditional caching. Some of the basics behind HTTP conditional caching are assumed in this post. If you haven’t already, or you just need a refresher take a look at Introduction to Conditional HTTP Caching with Rails.

Introduction to Conditional HTTP Caching with Rails

This post was originally published on the thoughtbot blog.

HTTP provides developers with a powerful set of tools to cache responses. Often times we don’t want a client to blindly cache content that it has been given. We may not be able to rely on setting specific expiration headers either. Instead we need a way for the client to ask the server whether or not a resource has been updated.

HTTP provides us with the ability to do this with conditional caching. A client can make a request to the server and find out of the server has a new version of the resource available.

CSS3 Transition Idiom

Exploring the use of CSS3 transitions, including browser feature detection, graceful degradation, and a simple idiom for applying transitions with fallbacks to JavaScript animations. Discusses the benefits of CSS transitions and methods for detecting browser support.