Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Add support to action-cache json requests wrapped in a callback (jsonp)

#3677

Given the following controller:

class PostsController < ApplicationController
  caches_action :index

  def index
    @posts = Post.all
    render :json => @posts, :callback => params[:callback]
  end
end

It's not possible to successfully cache json requests with callbacks (jsonp) because of the nature of how callbacks work.

This patch modifies the caches_action around filter by resetting the callback before rendering the fragment if it's a json request.

NOTE: This implementation saves the fragment with callback and reset it on read. Another implementation could be to remove the callback on save, and add (if necessary) on read.

Reported by Ary Djmal · January 9th, 2010 @ 10:41 PM

State: open
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Ary Djmal
    Ary Djmal
    • Title changed from Add support for action-cache json requests wrapped in a callback (jsonp) to Add support to action-cache json requests wrapped in a callback (jsonp)

    January 9th, 2010 @ 10:46 PM

  2. Rohit Arondekar
    Rohit Arondekar
    • State changed from new to stale
    • Importance changed from to Low

    Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.

    October 9th, 2010 @ 03:16 AM

  3. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 11th, 2010 @ 12:10 PM

  4. Ary Djmal
    Ary Djmal

    This is still an issue, I am uploading the updated patch.

    October 11th, 2010 @ 08:20 PM

  5. Ryan Bigg
    Ryan Bigg
    • State changed from stale to open

    This patch applies cleanly to master and the tests are complete. +1

    October 11th, 2010 @ 09:25 PM

  6. Ryan Bigg
    Ryan Bigg

    Automatic cleanup of spam.

    October 19th, 2010 @ 08:31 AM

  7. Jeff Kreeftmeijer