json_builder icon indicating copy to clipboard operation
json_builder copied to clipboard

cache issue

Open jackbit opened this issue 13 years ago • 4 comments

How to implement cache fragment and action here? it seems the chache_action doesnt work for json_builder

jackbit avatar Oct 07 '12 16:10 jackbit

here's my script in controller:

caches_action :index, 
                        :cache_path => Proc.new { |c| "#{c.params[:category].to_s.gsub(/\W/,'_')}_#{c.params[:per_page]}_#{c.params[:page]}" }, 
                        :gzip => :best_speed, 
                        :if => Proc.new { |c| c.params[:category].to_s =~ /all/i }
The output .json seems work
Read fragment views/all_podcast_50_1.json (80.0ms)
Read fragment views/all_twitter_50_1.json (200.8ms)
But .json_builder doesnt work
  Rendered forecasts/index.json.json_builder (25813.2ms)
Completed 200 OK in 36093ms (Views: 25959.5ms)
  Rendered forecasts/index.json.json_builder (10930.8ms)
Completed 200 OK in 46551ms (Views: 11033.0ms)

jackbit avatar Oct 07 '12 16:10 jackbit

Could you paste what the contents of forecasts/index.json.json_builder is?

dewski avatar Oct 08 '12 05:10 dewski

Is there a wiki on how to implement fragment cache with json_builder

gouthamvel avatar Feb 20 '13 10:02 gouthamvel

I'm wondering about this as well. I guess one of us will have to dig into the source and figure out how to best implement this, but some clues will be very much appreciated.

scomma avatar Apr 24 '13 10:04 scomma