Sha256: caab10f3bffc1f74bef2fa02d3bd092b3c9528fdbede3542eb0037ec71ac3ad8

Contents?: true

Size: 812 Bytes

Versions: 2

Compression:

Stored size: 812 Bytes

Contents

class RailsAppcache::ManifestsController < RailsAppcache::ApplicationController
  include RailsAppcache::ApplicationHelper

  before_filter :check_caching_enabled

  def show
    if params[:version] == appcache_version_string
      # This is a request from a current version of the page
      render params[:manifest]
    else
      # This is a request from an obsolete page, using an obsolete manifest
      # Serving a 404 enough to trigger an obsoletion event, which is purge
      # the manifest from the appcache.
      #
      # The client will get the correct version on the *next* page request
      display_404
    end
  end

  private

  def display_404
    render status: :not_found, text: ''
  end

  def check_caching_enabled
    display_404 unless RailsAppcache.config.perform_caching?
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_appcache-0.0.5 app/controllers/rails_appcache/manifests_controller.rb
rails_appcache-0.0.4 app/controllers/rails_appcache/manifests_controller.rb