This project is archived and is in readonly mode.
Add support to action-cache json requests wrapped in a callback (jsonp)
Reported by Ary Djmal | January 9th, 2010 @ 10:41 PM
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.
Comments and changes to this ticket
-
Ary Djmal January 9th, 2010 @ 10:46 PM
- 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)
-
Rohit Arondekar October 9th, 2010 @ 03:16 AM
- 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.
-
Ryan Bigg October 11th, 2010 @ 09:25 PM
- State changed from stale to open
This patch applies cleanly to master and the tests are complete. +1
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>