hawkins.io
hawkins.io copied to clipboard
Part 2: HTTP Caching on collection of objects
In Part 2 you have the following code:
def index
@posts = Post.scoped
if stale? @posts do
respond_with @posts
end
end
This code looks like it shouldn't work, as fresh_when has no way to handle arrays. In fact on Mongoid (can't test AR) it fails because Array doesn't have and update_at
methdod.
I know that your code segments are not supposed to work straight away, but I think this one is too unclear as to what you are trying to relate to the reader.