Skip to content

Instantly share code, notes, and snippets.

@raonirenosto
Created January 9, 2018 13:35
Show Gist options
  • Save raonirenosto/2b532988bed7782b4a07b8cc07dedb2e to your computer and use it in GitHub Desktop.
Save raonirenosto/2b532988bed7782b4a07b8cc07dedb2e to your computer and use it in GitHub Desktop.
Pegar if-modified-since apenas dos itens que foram atualizados
if_modified_since = Time.zone.parse(request.headers['If-Modified-Since']) || Time.zone
@users = User.where("updated_at > ?", if_modified_since).order(updated_at: :desc)
if stale?(@users.first)
render json: @users
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment